<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998

\section[Demand]{@Demand@: A decoupled implementation of a demand domain}
-}</span><span>
</span><span id="line-7"></span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# LANGUAGE CPP, FlexibleInstances, TypeSynonymInstances, RecordWildCards #-}</span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# OPTIONS_GHC -Wno-incomplete-uni-patterns #-}</span><span>
</span><span id="line-10"></span><span>
</span><span id="line-11"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Types.Demand</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-12"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier">StrDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier">UseDmd</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Count"><span class="hs-identifier">Count</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier">Demand</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdShell"><span class="hs-identifier">DmdShell</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier">CleanDemand</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#getStrDmd"><span class="hs-identifier">getStrDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#getUseDmd"><span class="hs-identifier">getUseDmd</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-15"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#mkProdDmd"><span class="hs-identifier">mkProdDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#mkOnceUsedDmd"><span class="hs-identifier">mkOnceUsedDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#mkManyUsedDmd"><span class="hs-identifier">mkManyUsedDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#mkHeadStrict"><span class="hs-identifier">mkHeadStrict</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#oneifyDmd"><span class="hs-identifier">oneifyDmd</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-16"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#toCleanDmd"><span class="hs-identifier">toCleanDmd</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-17"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#absDmd"><span class="hs-identifier">absDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#topDmd"><span class="hs-identifier">topDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#botDmd"><span class="hs-identifier">botDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#seqDmd"><span class="hs-identifier">seqDmd</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-18"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#lubDmd"><span class="hs-identifier">lubDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#bothDmd"><span class="hs-identifier">bothDmd</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#lazyApply1Dmd"><span class="hs-identifier">lazyApply1Dmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#lazyApply2Dmd"><span class="hs-identifier">lazyApply2Dmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#strictApply1Dmd"><span class="hs-identifier">strictApply1Dmd</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#isTopDmd"><span class="hs-identifier">isTopDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#isAbsDmd"><span class="hs-identifier">isAbsDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#isSeqDmd"><span class="hs-identifier">isSeqDmd</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-21"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#peelUseCall"><span class="hs-identifier">peelUseCall</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#cleanUseDmd_maybe"><span class="hs-identifier">cleanUseDmd_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#strictenDmd"><span class="hs-identifier">strictenDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#bothCleanDmd"><span class="hs-identifier">bothCleanDmd</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-22"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#addCaseBndrDmd"><span class="hs-identifier">addCaseBndrDmd</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-23"></span><span>
</span><span id="line-24"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier">DmdType</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#dmdTypeDepth"><span class="hs-identifier">dmdTypeDepth</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#lubDmdType"><span class="hs-identifier">lubDmdType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#bothDmdType"><span class="hs-identifier">bothDmdType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-25"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#BothDmdArg"><span class="hs-identifier">BothDmdArg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#mkBothDmdArg"><span class="hs-identifier">mkBothDmdArg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#toBothDmdArg"><span class="hs-identifier">toBothDmdArg</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-26"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#nopDmdType"><span class="hs-identifier">nopDmdType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#botDmdType"><span class="hs-identifier">botDmdType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#addDemand"><span class="hs-identifier">addDemand</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-27"></span><span>
</span><span id="line-28"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier">DmdEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#emptyDmdEnv"><span class="hs-identifier">emptyDmdEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#keepAliveDmdEnv"><span class="hs-identifier">keepAliveDmdEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-29"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#peelFV"><span class="hs-identifier">peelFV</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#findIdDemand"><span class="hs-identifier">findIdDemand</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-30"></span><span>
</span><span id="line-31"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier">Divergence</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#lubDivergence"><span class="hs-identifier">lubDivergence</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#isDeadEndDiv"><span class="hs-identifier">isDeadEndDiv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-32"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#topDiv"><span class="hs-identifier">topDiv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#botDiv"><span class="hs-identifier">botDiv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#exnDiv"><span class="hs-identifier">exnDiv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-33"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#appIsDeadEnd"><span class="hs-identifier">appIsDeadEnd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#isDeadEndSig"><span class="hs-identifier">isDeadEndSig</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#pprIfaceStrictSig"><span class="hs-identifier">pprIfaceStrictSig</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-34"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier">StrictSig</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#mkStrictSigForArity"><span class="hs-identifier">mkStrictSigForArity</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#mkClosedStrictSig"><span class="hs-identifier">mkClosedStrictSig</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-35"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#nopSig"><span class="hs-identifier">nopSig</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#botSig"><span class="hs-identifier">botSig</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-36"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#isTopSig"><span class="hs-identifier">isTopSig</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#hasDemandEnvSig"><span class="hs-identifier">hasDemandEnvSig</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-37"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#splitStrictSig"><span class="hs-identifier">splitStrictSig</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#strictSigDmdEnv"><span class="hs-identifier">strictSigDmdEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-38"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#prependArgsStrictSig"><span class="hs-identifier">prependArgsStrictSig</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#etaConvertStrictSig"><span class="hs-identifier">etaConvertStrictSig</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-39"></span><span>
</span><span id="line-40"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#seqDemand"><span class="hs-identifier">seqDemand</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#seqDemandList"><span class="hs-identifier">seqDemandList</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#seqDmdType"><span class="hs-identifier">seqDmdType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#seqStrictSig"><span class="hs-identifier">seqStrictSig</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-41"></span><span>
</span><span id="line-42"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#evalDmd"><span class="hs-identifier">evalDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#cleanEvalDmd"><span class="hs-identifier">cleanEvalDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#cleanEvalProdDmd"><span class="hs-identifier">cleanEvalProdDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#isStrictDmd"><span class="hs-identifier">isStrictDmd</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-43"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#splitDmdTy"><span class="hs-identifier">splitDmdTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#splitFVs"><span class="hs-identifier">splitFVs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#deferAfterPreciseException"><span class="hs-identifier">deferAfterPreciseException</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-44"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#postProcessUnsat"><span class="hs-identifier">postProcessUnsat</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#postProcessDmdType"><span class="hs-identifier">postProcessDmdType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-45"></span><span>
</span><span id="line-46"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#splitProdDmd_maybe"><span class="hs-identifier">splitProdDmd_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#peelCallDmd"><span class="hs-identifier">peelCallDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#peelManyCalls"><span class="hs-identifier">peelManyCalls</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#mkCallDmd"><span class="hs-identifier">mkCallDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#mkCallDmds"><span class="hs-identifier">mkCallDmds</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-47"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#mkWorkerDemand"><span class="hs-identifier">mkWorkerDemand</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#dmdTransformSig"><span class="hs-identifier">dmdTransformSig</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#dmdTransformDataConSig"><span class="hs-identifier">dmdTransformDataConSig</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-48"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#dmdTransformDictSelSig"><span class="hs-identifier">dmdTransformDictSelSig</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#argOneShots"><span class="hs-identifier">argOneShots</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#argsOneShots"><span class="hs-identifier">argsOneShots</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#saturatedByOneShots"><span class="hs-identifier">saturatedByOneShots</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-49"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#TypeShape"><span class="hs-identifier">TypeShape</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#trimToType"><span class="hs-identifier">trimToType</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-50"></span><span>
</span><span id="line-51"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#useCount"><span class="hs-identifier">useCount</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#isUsedOnce"><span class="hs-identifier">isUsedOnce</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#reuseEnv"><span class="hs-identifier">reuseEnv</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-52"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#zapUsageDemand"><span class="hs-identifier">zapUsageDemand</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#zapUsageEnvSig"><span class="hs-identifier">zapUsageEnvSig</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-53"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#zapUsedOnceDemand"><span class="hs-identifier">zapUsedOnceDemand</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#zapUsedOnceSig"><span class="hs-identifier">zapUsedOnceSig</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-54"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#strictifyDictDmd"><span class="hs-identifier">strictifyDictDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#strictifyDmd"><span class="hs-identifier">strictifyDmd</span></a></span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span>     </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-61"></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.html"><span class="hs-identifier">GHC.Types.Var</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier">Var</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier">Id</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html"><span class="hs-identifier">GHC.Types.Var.Env</span></a></span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span>
</span><span id="line-66"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span>
</span><span id="line-67"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Binary.html"><span class="hs-identifier">GHC.Utils.Binary</span></a></span><span>
</span><span id="line-70"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html"><span class="hs-identifier">GHC.Data.Maybe</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html#orElse"><span class="hs-identifier">orElse</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-71"></span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier">Type</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#isNewTyCon"><span class="hs-identifier">isNewTyCon</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#isClassTyCon"><span class="hs-identifier">isClassTyCon</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-74"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html"><span class="hs-identifier">GHC.Core.DataCon</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.DataCon.html#splitDataProductType_maybe"><span class="hs-identifier">splitDataProductType_maybe</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-75"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Multiplicity.html"><span class="hs-identifier">GHC.Core.Multiplicity</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier">scaledThing</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-76"></span><span>
</span><span id="line-77"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
        Joint domain for Strictness and Absence
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-84"></span><span>
</span><span id="line-85"></span><span class="hs-keyword">data</span><span> </span><span id="JointDmd"><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-var">JointDmd</span></a></span></span><span> </span><span id="local-6989586621680811036"><span class="annot"><a href="#local-6989586621680811036"><span class="hs-identifier hs-type">s</span></a></span></span><span> </span><span id="local-6989586621680811035"><span class="annot"><a href="#local-6989586621680811035"><span class="hs-identifier hs-type">u</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="JD"><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-var">JD</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="sd"><span class="annot"><span class="annottext">forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var hs-var">sd</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680811036"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span id="ud"><span class="annot"><span class="annottext">forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var hs-var">ud</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680811035"><span class="hs-identifier hs-type">u</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-86"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span> </span><span id="local-6989586621680810639"><span id="local-6989586621680810643"><span class="annot"><span class="annottext">JointDmd s u -&gt; JointDmd s u -&gt; Bool
(JointDmd s u -&gt; JointDmd s u -&gt; Bool)
-&gt; (JointDmd s u -&gt; JointDmd s u -&gt; Bool) -&gt; Eq (JointDmd s u)
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
forall s u. (Eq s, Eq u) =&gt; JointDmd s u -&gt; JointDmd s u -&gt; Bool
/= :: JointDmd s u -&gt; JointDmd s u -&gt; Bool
$c/= :: forall s u. (Eq s, Eq u) =&gt; JointDmd s u -&gt; JointDmd s u -&gt; Bool
== :: JointDmd s u -&gt; JointDmd s u -&gt; Bool
$c== :: forall s u. (Eq s, Eq u) =&gt; JointDmd s u -&gt; JointDmd s u -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810629"><span id="local-6989586621680810631"><span id="local-6989586621680810636"><span class="annot"><span class="annottext">Int -&gt; JointDmd s u -&gt; ShowS
[JointDmd s u] -&gt; ShowS
JointDmd s u -&gt; String
(Int -&gt; JointDmd s u -&gt; ShowS)
-&gt; (JointDmd s u -&gt; String)
-&gt; ([JointDmd s u] -&gt; ShowS)
-&gt; Show (JointDmd s u)
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
forall s u. (Show s, Show u) =&gt; Int -&gt; JointDmd s u -&gt; ShowS
forall s u. (Show s, Show u) =&gt; [JointDmd s u] -&gt; ShowS
forall s u. (Show s, Show u) =&gt; JointDmd s u -&gt; String
showList :: [JointDmd s u] -&gt; ShowS
$cshowList :: forall s u. (Show s, Show u) =&gt; [JointDmd s u] -&gt; ShowS
show :: JointDmd s u -&gt; String
$cshow :: forall s u. (Show s, Show u) =&gt; JointDmd s u -&gt; String
showsPrec :: Int -&gt; JointDmd s u -&gt; ShowS
$cshowsPrec :: forall s u. (Show s, Show u) =&gt; Int -&gt; JointDmd s u -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-87"></span><span>
</span><span id="line-88"></span><span id="local-6989586621680810626"><span id="local-6989586621680810627"><span class="annot"><a href="GHC.Types.Demand.html#getStrDmd"><span class="hs-identifier hs-type">getStrDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810627"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810626"><span class="hs-identifier hs-type">u</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680810627"><span class="hs-identifier hs-type">s</span></a></span></span></span><span>
</span><span id="line-89"></span><span id="getStrDmd"><span class="annot"><span class="annottext">getStrDmd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#getStrDmd"><span class="hs-identifier hs-var hs-var">getStrDmd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JointDmd s u -&gt; s
forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var hs-var">sd</span></a></span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span id="local-6989586621680810624"><span id="local-6989586621680810625"><span class="annot"><a href="GHC.Types.Demand.html#getUseDmd"><span class="hs-identifier hs-type">getUseDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810625"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810624"><span class="hs-identifier hs-type">u</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680810624"><span class="hs-identifier hs-type">u</span></a></span></span></span><span>
</span><span id="line-92"></span><span id="getUseDmd"><span class="annot"><span class="annottext">getUseDmd :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#getUseDmd"><span class="hs-identifier hs-var hs-var">getUseDmd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JointDmd s u -&gt; u
forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var hs-var">ud</span></a></span><span>
</span><span id="line-93"></span><span>
</span><span id="line-94"></span><span class="hs-comment">-- Pretty-printing</span><span>
</span><span id="line-95"></span><span id="local-6989586621680811037"><span id="local-6989586621680811038"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680810621"><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680811038"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680811037"><span class="hs-identifier hs-type">u</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680811038"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680811037"><span class="hs-identifier hs-type">u</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-96"></span><span>  </span><span id="local-6989586621680810617"><span class="annot"><span class="annottext">ppr :: JointDmd s u -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810615"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621680810615"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810614"><span class="annot"><span class="annottext">u
</span><a href="#local-6989586621680810614"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#angleBrackets"><span class="hs-identifier hs-var">angleBrackets</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">s -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621680810615"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">','</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">u -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">u
</span><a href="#local-6989586621680810614"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-97"></span><span>
</span><span id="line-98"></span><span class="hs-comment">-- Well-formedness preserving constructors for the joint domain</span><span>
</span><span id="line-99"></span><span id="local-6989586621680811020"><span id="local-6989586621680811021"><span class="annot"><a href="GHC.Types.Demand.html#mkJointDmd"><span class="hs-identifier hs-type">mkJointDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="#local-6989586621680811021"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680811020"><span class="hs-identifier hs-type">u</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680811021"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680811020"><span class="hs-identifier hs-type">u</span></a></span></span></span><span>
</span><span id="line-100"></span><span id="mkJointDmd"><span class="annot"><span class="annottext">mkJointDmd :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#mkJointDmd"><span class="hs-identifier hs-var hs-var">mkJointDmd</span></a></span></span><span> </span><span id="local-6989586621680810609"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621680810609"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span id="local-6989586621680810608"><span class="annot"><span class="annottext">u
</span><a href="#local-6989586621680810608"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621680810609"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">u
</span><a href="#local-6989586621680810608"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-101"></span><span>
</span><span id="line-102"></span><span id="local-6989586621680811016"><span id="local-6989586621680811017"><span class="annot"><a href="GHC.Types.Demand.html#mkJointDmds"><span class="hs-identifier hs-type">mkJointDmds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680811017"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="#local-6989586621680811016"><span class="hs-identifier hs-type">u</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680811017"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680811016"><span class="hs-identifier hs-type">u</span></a></span><span class="hs-special">]</span></span></span><span>
</span><span id="line-103"></span><span id="mkJointDmds"><span class="annot"><span class="annottext">mkJointDmds :: forall s u. [s] -&gt; [u] -&gt; [JointDmd s u]
</span><a href="GHC.Types.Demand.html#mkJointDmds"><span class="hs-identifier hs-var hs-var">mkJointDmds</span></a></span></span><span> </span><span id="local-6989586621680810606"><span class="annot"><span class="annottext">[s]
</span><a href="#local-6989586621680810606"><span class="hs-identifier hs-var">ss</span></a></span></span><span> </span><span id="local-6989586621680810605"><span class="annot"><span class="annottext">[u]
</span><a href="#local-6989586621680810605"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; (s -&gt; u -&gt; JointDmd s u) -&gt; [s] -&gt; [u] -&gt; [JointDmd s u]
forall a b c. String -&gt; (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#zipWithEqual"><span class="hs-identifier hs-var">zipWithEqual</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mkJointDmds&quot;</span></span><span> </span><span class="annot"><span class="annottext">s -&gt; u -&gt; JointDmd s u
forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#mkJointDmd"><span class="hs-identifier hs-var">mkJointDmd</span></a></span><span> </span><span class="annot"><span class="annottext">[s]
</span><a href="#local-6989586621680810606"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="annot"><span class="annottext">[u]
</span><a href="#local-6989586621680810605"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span>
</span><span id="line-106"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
            Strictness domain
*                                                                      *
************************************************************************

          Lazy
           |
        HeadStr
        /     \
    SCall      SProd
        \     /
        HyperStr

Note [Exceptions and strictness]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We used to smart about catching exceptions, but we aren't anymore.
See #14998 for the way it's resolved at the moment.

Here's a historic breakdown:

Apparently, exception handling prim-ops didn't use to have any special
strictness signatures, thus defaulting to nopSig, which assumes they use their
arguments lazily. Joachim was the first to realise that we could provide richer
information. Thus, in 0558911f91c (Dec 13), he added signatures to
primops.txt.pp indicating that functions like `catch#` and `catchRetry#` call
their argument, which is useful information for usage analysis. Still with a
'Lazy' strictness demand (i.e. 'lazyApply1Dmd'), though, and the world was fine.

In 7c0fff4 (July 15), Simon argued that giving `catch#` et al. a
'strictApply1Dmd' leads to substantial performance gains. That was at the cost
of correctness, as #10712 proved. So, back to 'lazyApply1Dmd' in
28638dfe79e (Dec 15).

Motivated to reproduce the gains of 7c0fff4 without the breakage of #10712,
Ben opened #11222. Simon made the demand analyser &quot;understand catch&quot; in
9915b656 (Jan 16) by adding a new 'catchArgDmd', which basically said to call
its argument strictly, but also swallow any thrown exceptions in
'postProcessDivergence'. This was realized by extending the 'Str' constructor of
'ArgStr' with a 'ExnStr' field, indicating that it catches the exception, and
adding a 'ThrowsExn' constructor to the 'Divergence' lattice as an element
between 'Dunno' and 'Diverges'. Then along came #11555 and finally #13330,
so we had to revert to 'lazyApply1Dmd' again in 701256df88c (Mar 17).

This left the other variants like 'catchRetry#' having 'catchArgDmd', which is
where #14998 picked up. Item 1 was concerned with measuring the impact of also
making `catchRetry#` and `catchSTM#` have 'lazyApply1Dmd'. The result was that
there was none. We removed the last usages of 'catchArgDmd' in 00b8ecb7
(Apr 18). There was a lot of dead code resulting from that change, that we
removed in ef6b283 (Jan 19): We got rid of 'ThrowsExn' and 'ExnStr' again and
removed any code that was dealing with the peculiarities.

Where did the speed-ups vanish to? In #14998, item 3 established that
turning 'catch#' strict in its first argument didn't bring back any of the
alleged performance benefits. Item 2 of that ticket finally found out that it
was entirely due to 'catchException's new (since #11555) definition, which
was simply

    catchException !io handler = catch io handler

While 'catchException' is arguably the saner semantics for 'catch', it is an
internal helper function in &quot;GHC.IO&quot;. Its use in
&quot;GHC.IO.Handle.Internals.do_operation&quot; made for the huge allocation differences:
Remove the bang and you find the regressions we originally wanted to avoid with
'catchArgDmd'. See also #exceptions_and_strictness# in &quot;GHC.IO&quot;.

So history keeps telling us that the only possibly correct strictness annotation
for the first argument of 'catch#' is 'lazyApply1Dmd', because 'catch#' really
is not strict in its argument: Just try this in GHCi

  :set -XScopedTypeVariables
  import Control.Exception
  catch undefined (\(_ :: SomeException) -&gt; putStrLn &quot;you'll see this&quot;)

Any analysis that assumes otherwise will be broken in some way or another
(beyond `-fno-pendantic-bottoms`).

But then #13380 and #17676 suggest (in Mar 20) that we need to re-introduce a
subtly different variant of `ThrowsExn` (which we call `ExnOrDiv` now) that is
only used by `raiseIO#` in order to preserve precise exceptions by strictness
analysis, while not impacting the ability to eliminate dead code.
See Note [Precise exceptions and strictness analysis].

-}</span><span>
</span><span id="line-191"></span><span>
</span><span id="line-192"></span><span class="hs-comment">-- | Vanilla strictness domain</span><span>
</span><span id="line-193"></span><span class="hs-keyword">data</span><span> </span><span id="StrDmd"><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-var">StrDmd</span></a></span></span><span>
</span><span id="line-194"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="HyperStr"><span class="annot"><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span></span><span>             </span><span class="hs-comment">-- ^ Hyper-strict (bottom of the lattice).</span><span>
</span><span id="line-195"></span><span>                         </span><span class="hs-comment">-- See Note [HyperStr and Use demands]</span><span>
</span><span id="line-196"></span><span>
</span><span id="line-197"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="SCall"><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-var">SCall</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span>         </span><span class="hs-comment">-- ^ Call demand</span><span>
</span><span id="line-198"></span><span>                         </span><span class="hs-comment">-- Used only for values of function type</span><span>
</span><span id="line-199"></span><span>
</span><span id="line-200"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="SProd"><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-var">SProd</span></a></span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span class="hs-special">]</span><span>       </span><span class="hs-comment">-- ^ Product</span><span>
</span><span id="line-201"></span><span>                         </span><span class="hs-comment">-- Used only for values of product type</span><span>
</span><span id="line-202"></span><span>                         </span><span class="hs-comment">-- Invariant: not all components are HyperStr (use HyperStr)</span><span>
</span><span id="line-203"></span><span>                         </span><span class="hs-comment">--            not all components are Lazy     (use HeadStr)</span><span>
</span><span id="line-204"></span><span>
</span><span id="line-205"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="HeadStr"><span class="annot"><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span></span><span>              </span><span class="hs-comment">-- ^ Head-Strict</span><span>
</span><span id="line-206"></span><span>                         </span><span class="hs-comment">-- A polymorphic demand: used for values of all types,</span><span>
</span><span id="line-207"></span><span>                         </span><span class="hs-comment">--                       including a type variable</span><span>
</span><span id="line-208"></span><span>
</span><span id="line-209"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span> </span><span id="local-6989586621680810592"><span id="local-6989586621680810598"><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd -&gt; Bool
(StrDmd -&gt; StrDmd -&gt; Bool)
-&gt; (StrDmd -&gt; StrDmd -&gt; Bool) -&gt; Eq StrDmd
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: StrDmd -&gt; StrDmd -&gt; Bool
$c/= :: StrDmd -&gt; StrDmd -&gt; Bool
== :: StrDmd -&gt; StrDmd -&gt; Bool
$c== :: StrDmd -&gt; StrDmd -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810580"><span id="local-6989586621680810582"><span id="local-6989586621680810590"><span class="annot"><span class="annottext">Int -&gt; StrDmd -&gt; ShowS
[StrDmd] -&gt; ShowS
StrDmd -&gt; String
(Int -&gt; StrDmd -&gt; ShowS)
-&gt; (StrDmd -&gt; String) -&gt; ([StrDmd] -&gt; ShowS) -&gt; Show StrDmd
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [StrDmd] -&gt; ShowS
$cshowList :: [StrDmd] -&gt; ShowS
show :: StrDmd -&gt; String
$cshow :: StrDmd -&gt; String
showsPrec :: Int -&gt; StrDmd -&gt; ShowS
$cshowsPrec :: Int -&gt; StrDmd -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span class="hs-comment">-- | Strictness of a function argument.</span><span>
</span><span id="line-212"></span><span class="hs-keyword">type</span><span> </span><span id="ArgStr"><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-var">ArgStr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span>
</span><span id="line-213"></span><span>
</span><span id="line-214"></span><span class="hs-comment">-- | Strictness demand.</span><span>
</span><span id="line-215"></span><span class="hs-keyword">data</span><span> </span><span id="Str"><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span></span><span> </span><span id="local-6989586621680811009"><span class="annot"><a href="#local-6989586621680811009"><span class="hs-identifier hs-type">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="Lazy"><span class="annot"><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span></span><span>  </span><span class="hs-comment">-- ^ Lazy (top of the lattice)</span><span>
</span><span id="line-216"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span id="Str"><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span></span><span> </span><span class="annot"><a href="#local-6989586621680811009"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-comment">-- ^ Strict</span><span>
</span><span id="line-217"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span> </span><span id="local-6989586621680810573"><span id="local-6989586621680810576"><span class="annot"><span class="annottext">Str s -&gt; Str s -&gt; Bool
(Str s -&gt; Str s -&gt; Bool) -&gt; (Str s -&gt; Str s -&gt; Bool) -&gt; Eq (Str s)
forall s. Eq s =&gt; Str s -&gt; Str s -&gt; Bool
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: Str s -&gt; Str s -&gt; Bool
$c/= :: forall s. Eq s =&gt; Str s -&gt; Str s -&gt; Bool
== :: Str s -&gt; Str s -&gt; Bool
$c== :: forall s. Eq s =&gt; Str s -&gt; Str s -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810565"><span id="local-6989586621680810567"><span id="local-6989586621680810571"><span class="annot"><span class="annottext">Int -&gt; Str s -&gt; ShowS
[Str s] -&gt; ShowS
Str s -&gt; String
(Int -&gt; Str s -&gt; ShowS)
-&gt; (Str s -&gt; String) -&gt; ([Str s] -&gt; ShowS) -&gt; Show (Str s)
forall s. Show s =&gt; Int -&gt; Str s -&gt; ShowS
forall s. Show s =&gt; [Str s] -&gt; ShowS
forall s. Show s =&gt; Str s -&gt; String
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [Str s] -&gt; ShowS
$cshowList :: forall s. Show s =&gt; [Str s] -&gt; ShowS
show :: Str s -&gt; String
$cshow :: forall s. Show s =&gt; Str s -&gt; String
showsPrec :: Int -&gt; Str s -&gt; ShowS
$cshowsPrec :: forall s. Show s =&gt; Int -&gt; Str s -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-218"></span><span>
</span><span id="line-219"></span><span class="hs-comment">-- Well-formedness preserving constructors for the Strictness domain</span><span>
</span><span id="line-220"></span><span class="annot"><a href="GHC.Types.Demand.html#strBot"><span class="hs-identifier hs-type">strBot</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#strTop"><span class="hs-identifier hs-type">strTop</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span>
</span><span id="line-221"></span><span id="strBot"><span class="annot"><span class="annottext">strBot :: ArgStr
</span><a href="GHC.Types.Demand.html#strBot"><span class="hs-identifier hs-var hs-var">strBot</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>
</span><span id="line-222"></span><span id="strTop"><span class="annot"><span class="annottext">strTop :: ArgStr
</span><a href="GHC.Types.Demand.html#strTop"><span class="hs-identifier hs-var hs-var">strTop</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>
</span><span id="line-223"></span><span>
</span><span id="line-224"></span><span class="annot"><a href="GHC.Types.Demand.html#mkSCall"><span class="hs-identifier hs-type">mkSCall</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span>
</span><span id="line-225"></span><span id="mkSCall"><span class="annot"><span class="annottext">mkSCall :: StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#mkSCall"><span class="hs-identifier hs-var hs-var">mkSCall</span></a></span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>
</span><span id="line-226"></span><span class="annot"><a href="GHC.Types.Demand.html#mkSCall"><span class="hs-identifier hs-var">mkSCall</span></a></span><span> </span><span id="local-6989586621680810561"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810561"><span class="hs-identifier hs-var">s</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-var">SCall</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810561"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-227"></span><span>
</span><span id="line-228"></span><span class="annot"><a href="GHC.Types.Demand.html#mkSProd"><span class="hs-identifier hs-type">mkSProd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span>
</span><span id="line-229"></span><span id="mkSProd"><span class="annot"><span class="annottext">mkSProd :: [ArgStr] -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#mkSProd"><span class="hs-identifier hs-var hs-var">mkSProd</span></a></span></span><span> </span><span id="local-6989586621680810559"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810559"><span class="hs-identifier hs-var">sx</span></a></span></span><span>
</span><span id="line-230"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">(ArgStr -&gt; Bool) -&gt; [ArgStr] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; Bool
</span><a href="GHC.Types.Demand.html#isHyperStr"><span class="hs-identifier hs-var">isHyperStr</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810559"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>
</span><span id="line-231"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">(ArgStr -&gt; Bool) -&gt; [ArgStr] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; Bool
</span><a href="GHC.Types.Demand.html#isLazy"><span class="hs-identifier hs-var">isLazy</span></a></span><span>     </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810559"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>
</span><span id="line-232"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-var">SProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810559"><span class="hs-identifier hs-var">sx</span></a></span><span>
</span><span id="line-233"></span><span>
</span><span id="line-234"></span><span class="annot"><a href="GHC.Types.Demand.html#isLazy"><span class="hs-identifier hs-type">isLazy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-235"></span><span id="isLazy"><span class="annot"><span class="annottext">isLazy :: ArgStr -&gt; Bool
</span><a href="GHC.Types.Demand.html#isLazy"><span class="hs-identifier hs-var hs-var">isLazy</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-236"></span><span class="annot"><a href="GHC.Types.Demand.html#isLazy"><span class="hs-identifier hs-var">isLazy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-237"></span><span>
</span><span id="line-238"></span><span class="annot"><a href="GHC.Types.Demand.html#isHyperStr"><span class="hs-identifier hs-type">isHyperStr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-239"></span><span id="isHyperStr"><span class="annot"><span class="annottext">isHyperStr :: ArgStr -&gt; Bool
</span><a href="GHC.Types.Demand.html#isHyperStr"><span class="hs-identifier hs-var hs-var">isHyperStr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-240"></span><span class="annot"><a href="GHC.Types.Demand.html#isHyperStr"><span class="hs-identifier hs-var">isHyperStr</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><span class="hs-identifier">_</span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-241"></span><span>
</span><span id="line-242"></span><span class="hs-comment">-- Pretty-printing</span><span>
</span><span id="line-243"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680810552"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-244"></span><span>  </span><span id="local-6989586621680810549"><span class="annot"><span class="annottext">ppr :: StrDmd -&gt; SDoc
</span><a href="#local-6989586621680810549"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'B'</span></span><span>
</span><span id="line-245"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680810548"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810548"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'C'</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810548"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-246"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'S'</span></span><span>
</span><span id="line-247"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span id="local-6989586621680810546"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810546"><span class="hs-identifier hs-var">sx</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'S'</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hcat"><span class="hs-identifier hs-var">hcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgStr -&gt; SDoc) -&gt; [ArgStr] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810546"><span class="hs-identifier hs-var">sx</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-248"></span><span>
</span><span id="line-249"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680810542"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-250"></span><span>  </span><span id="local-6989586621680810540"><span class="annot"><span class="annottext">ppr :: ArgStr -&gt; SDoc
</span><a href="#local-6989586621680810540"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span id="local-6989586621680810539"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810539"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810539"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-251"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'L'</span></span><span>
</span><span id="line-252"></span><span>
</span><span id="line-253"></span><span class="annot"><a href="GHC.Types.Demand.html#lubArgStr"><span class="hs-identifier hs-type">lubArgStr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span>
</span><span id="line-254"></span><span id="lubArgStr"><span class="annot"><span class="annottext">lubArgStr :: ArgStr -&gt; ArgStr -&gt; ArgStr
</span><a href="GHC.Types.Demand.html#lubArgStr"><span class="hs-identifier hs-var hs-var">lubArgStr</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>     </span><span class="annot"><span class="annottext">ArgStr
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>
</span><span id="line-255"></span><span class="annot"><a href="GHC.Types.Demand.html#lubArgStr"><span class="hs-identifier hs-var">lubArgStr</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><span class="hs-identifier">_</span></span><span>        </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>
</span><span id="line-256"></span><span class="annot"><a href="GHC.Types.Demand.html#lubArgStr"><span class="hs-identifier hs-var">lubArgStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span id="local-6989586621680810537"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810537"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span id="local-6989586621680810536"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810536"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810537"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#lubStr"><span class="hs-operator hs-var">`lubStr`</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810536"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-257"></span><span>
</span><span id="line-258"></span><span class="annot"><a href="GHC.Types.Demand.html#lubStr"><span class="hs-identifier hs-type">lubStr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span>
</span><span id="line-259"></span><span id="lubStr"><span class="annot"><span class="annottext">lubStr :: StrDmd -&gt; StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#lubStr"><span class="hs-identifier hs-var hs-var">lubStr</span></a></span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span> </span><span id="local-6989586621680810534"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810534"><span class="hs-identifier hs-var">s</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810534"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-260"></span><span class="annot"><a href="GHC.Types.Demand.html#lubStr"><span class="hs-identifier hs-var">lubStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680810533"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810533"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-var">SCall</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810533"><span class="hs-identifier hs-var">s1</span></a></span><span>
</span><span id="line-261"></span><span class="annot"><a href="GHC.Types.Demand.html#lubStr"><span class="hs-identifier hs-var">lubStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>
</span><span id="line-262"></span><span class="annot"><a href="GHC.Types.Demand.html#lubStr"><span class="hs-identifier hs-var">lubStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680810532"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810532"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680810531"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810531"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-var">SCall</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810532"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#lubStr"><span class="hs-operator hs-var">`lubStr`</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810531"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-263"></span><span class="annot"><a href="GHC.Types.Demand.html#lubStr"><span class="hs-identifier hs-var">lubStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>
</span><span id="line-264"></span><span class="annot"><a href="GHC.Types.Demand.html#lubStr"><span class="hs-identifier hs-var">lubStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span id="local-6989586621680810530"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810530"><span class="hs-identifier hs-var">sx</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-var">SProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810530"><span class="hs-identifier hs-var">sx</span></a></span><span>
</span><span id="line-265"></span><span class="annot"><a href="GHC.Types.Demand.html#lubStr"><span class="hs-identifier hs-var">lubStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>
</span><span id="line-266"></span><span class="annot"><a href="GHC.Types.Demand.html#lubStr"><span class="hs-identifier hs-var">lubStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span id="local-6989586621680810529"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810529"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span id="local-6989586621680810528"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810528"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-267"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810529"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; [ArgStr] -&gt; Bool
forall a b. [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-operator hs-var">`equalLength`</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810528"><span class="hs-identifier hs-var">s2</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#mkSProd"><span class="hs-identifier hs-var">mkSProd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgStr -&gt; ArgStr -&gt; ArgStr) -&gt; [ArgStr] -&gt; [ArgStr] -&gt; [ArgStr]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; ArgStr -&gt; ArgStr
</span><a href="GHC.Types.Demand.html#lubArgStr"><span class="hs-identifier hs-var">lubArgStr</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810529"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810528"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-268"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>
</span><span id="line-269"></span><span class="annot"><a href="GHC.Types.Demand.html#lubStr"><span class="hs-identifier hs-var">lubStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>
</span><span id="line-270"></span><span class="annot"><a href="GHC.Types.Demand.html#lubStr"><span class="hs-identifier hs-var">lubStr</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>   </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>
</span><span id="line-271"></span><span>
</span><span id="line-272"></span><span class="annot"><a href="GHC.Types.Demand.html#bothArgStr"><span class="hs-identifier hs-type">bothArgStr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span>
</span><span id="line-273"></span><span id="bothArgStr"><span class="annot"><span class="annottext">bothArgStr :: ArgStr -&gt; ArgStr -&gt; ArgStr
</span><a href="GHC.Types.Demand.html#bothArgStr"><span class="hs-identifier hs-var hs-var">bothArgStr</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>     </span><span id="local-6989586621680810524"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810524"><span class="hs-identifier hs-var">s</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810524"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-274"></span><span class="annot"><a href="GHC.Types.Demand.html#bothArgStr"><span class="hs-identifier hs-var">bothArgStr</span></a></span><span> </span><span id="local-6989586621680810523"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810523"><span class="hs-identifier hs-var">s</span></a></span></span><span>        </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810523"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-275"></span><span class="annot"><a href="GHC.Types.Demand.html#bothArgStr"><span class="hs-identifier hs-var">bothArgStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span id="local-6989586621680810522"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810522"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span id="local-6989586621680810521"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810521"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810522"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#bothStr"><span class="hs-operator hs-var">`bothStr`</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810521"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-276"></span><span>
</span><span id="line-277"></span><span class="annot"><a href="GHC.Types.Demand.html#bothStr"><span class="hs-identifier hs-type">bothStr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span>
</span><span id="line-278"></span><span id="bothStr"><span class="annot"><span class="annottext">bothStr :: StrDmd -&gt; StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#bothStr"><span class="hs-identifier hs-var hs-var">bothStr</span></a></span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>
</span><span id="line-279"></span><span class="annot"><a href="GHC.Types.Demand.html#bothStr"><span class="hs-identifier hs-var">bothStr</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span> </span><span id="local-6989586621680810519"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810519"><span class="hs-identifier hs-var">s</span></a></span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810519"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-280"></span><span class="annot"><a href="GHC.Types.Demand.html#bothStr"><span class="hs-identifier hs-var">bothStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>
</span><span id="line-281"></span><span class="annot"><a href="GHC.Types.Demand.html#bothStr"><span class="hs-identifier hs-var">bothStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680810518"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810518"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-var">SCall</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810518"><span class="hs-identifier hs-var">s1</span></a></span><span>
</span><span id="line-282"></span><span class="annot"><a href="GHC.Types.Demand.html#bothStr"><span class="hs-identifier hs-var">bothStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680810517"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810517"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680810516"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810516"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-var">SCall</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810517"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#bothStr"><span class="hs-operator hs-var">`bothStr`</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810516"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-283"></span><span class="annot"><a href="GHC.Types.Demand.html#bothStr"><span class="hs-identifier hs-var">bothStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>  </span><span class="hs-comment">-- Weird</span><span>
</span><span id="line-284"></span><span>
</span><span id="line-285"></span><span class="annot"><a href="GHC.Types.Demand.html#bothStr"><span class="hs-identifier hs-var">bothStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>
</span><span id="line-286"></span><span class="annot"><a href="GHC.Types.Demand.html#bothStr"><span class="hs-identifier hs-var">bothStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span id="local-6989586621680810515"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810515"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-var">SProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810515"><span class="hs-identifier hs-var">s1</span></a></span><span>
</span><span id="line-287"></span><span class="annot"><a href="GHC.Types.Demand.html#bothStr"><span class="hs-identifier hs-var">bothStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span id="local-6989586621680810514"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810514"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span id="local-6989586621680810513"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810513"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-288"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810514"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; [ArgStr] -&gt; Bool
forall a b. [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-operator hs-var">`equalLength`</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810513"><span class="hs-identifier hs-var">s2</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#mkSProd"><span class="hs-identifier hs-var">mkSProd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgStr -&gt; ArgStr -&gt; ArgStr) -&gt; [ArgStr] -&gt; [ArgStr] -&gt; [ArgStr]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; ArgStr -&gt; ArgStr
</span><a href="GHC.Types.Demand.html#bothArgStr"><span class="hs-identifier hs-var">bothArgStr</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810514"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810513"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-289"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>  </span><span class="hs-comment">-- Weird</span><span>
</span><span id="line-290"></span><span class="annot"><a href="GHC.Types.Demand.html#bothStr"><span class="hs-identifier hs-var">bothStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>
</span><span id="line-291"></span><span>
</span><span id="line-292"></span><span class="hs-comment">-- utility functions to deal with memory leaks</span><span>
</span><span id="line-293"></span><span class="annot"><a href="GHC.Types.Demand.html#seqStrDmd"><span class="hs-identifier hs-type">seqStrDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-294"></span><span id="seqStrDmd"><span class="annot"><span class="annottext">seqStrDmd :: StrDmd -&gt; ()
</span><a href="GHC.Types.Demand.html#seqStrDmd"><span class="hs-identifier hs-var hs-var">seqStrDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span id="local-6989586621680810511"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810511"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; ()
</span><a href="GHC.Types.Demand.html#seqStrDmdList"><span class="hs-identifier hs-var">seqStrDmdList</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810511"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-295"></span><span class="annot"><a href="GHC.Types.Demand.html#seqStrDmd"><span class="hs-identifier hs-var">seqStrDmd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680810509"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810509"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ()
</span><a href="GHC.Types.Demand.html#seqStrDmd"><span class="hs-identifier hs-var">seqStrDmd</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810509"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-296"></span><span class="annot"><a href="GHC.Types.Demand.html#seqStrDmd"><span class="hs-identifier hs-var">seqStrDmd</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-297"></span><span>
</span><span id="line-298"></span><span class="annot"><a href="GHC.Types.Demand.html#seqStrDmdList"><span class="hs-identifier hs-type">seqStrDmdList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-299"></span><span id="seqStrDmdList"><span class="annot"><span class="annottext">seqStrDmdList :: [ArgStr] -&gt; ()
</span><a href="GHC.Types.Demand.html#seqStrDmdList"><span class="hs-identifier hs-var hs-var">seqStrDmdList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-300"></span><span class="annot"><a href="GHC.Types.Demand.html#seqStrDmdList"><span class="hs-identifier hs-var">seqStrDmdList</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680810508"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810508"><span class="hs-identifier hs-var">d</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680810507"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810507"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; ()
</span><a href="GHC.Types.Demand.html#seqArgStr"><span class="hs-identifier hs-var">seqArgStr</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810508"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; ()
</span><a href="GHC.Types.Demand.html#seqStrDmdList"><span class="hs-identifier hs-var">seqStrDmdList</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810507"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-301"></span><span>
</span><span id="line-302"></span><span class="annot"><a href="GHC.Types.Demand.html#seqArgStr"><span class="hs-identifier hs-type">seqArgStr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-303"></span><span id="seqArgStr"><span class="annot"><span class="annottext">seqArgStr :: ArgStr -&gt; ()
</span><a href="GHC.Types.Demand.html#seqArgStr"><span class="hs-identifier hs-var hs-var">seqArgStr</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-304"></span><span class="annot"><a href="GHC.Types.Demand.html#seqArgStr"><span class="hs-identifier hs-var">seqArgStr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span id="local-6989586621680810505"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810505"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ()
</span><a href="GHC.Types.Demand.html#seqStrDmd"><span class="hs-identifier hs-var">seqStrDmd</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810505"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-305"></span><span>
</span><span id="line-306"></span><span class="hs-comment">-- Splitting polymorphic demands</span><span>
</span><span id="line-307"></span><span class="annot"><a href="GHC.Types.Demand.html#splitArgStrProdDmd"><span class="hs-identifier hs-type">splitArgStrProdDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-308"></span><span id="splitArgStrProdDmd"><span class="annot"><span class="annottext">splitArgStrProdDmd :: Int -&gt; ArgStr -&gt; Maybe [ArgStr]
</span><a href="GHC.Types.Demand.html#splitArgStrProdDmd"><span class="hs-identifier hs-var hs-var">splitArgStrProdDmd</span></a></span></span><span> </span><span id="local-6989586621680810503"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810503"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; Maybe [ArgStr]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ArgStr -&gt; [ArgStr]
forall a. Int -&gt; a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#replicate"><span class="hs-identifier hs-var">replicate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810503"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-309"></span><span class="annot"><a href="GHC.Types.Demand.html#splitArgStrProdDmd"><span class="hs-identifier hs-var">splitArgStrProdDmd</span></a></span><span> </span><span id="local-6989586621680810501"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810501"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span id="local-6989586621680810500"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810500"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; StrDmd -&gt; Maybe [ArgStr]
</span><a href="GHC.Types.Demand.html#splitStrProdDmd"><span class="hs-identifier hs-var">splitStrProdDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810501"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810500"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-310"></span><span>
</span><span id="line-311"></span><span class="annot"><a href="GHC.Types.Demand.html#splitStrProdDmd"><span class="hs-identifier hs-type">splitStrProdDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-312"></span><span id="splitStrProdDmd"><span class="annot"><span class="annottext">splitStrProdDmd :: Int -&gt; StrDmd -&gt; Maybe [ArgStr]
</span><a href="GHC.Types.Demand.html#splitStrProdDmd"><span class="hs-identifier hs-var hs-var">splitStrProdDmd</span></a></span></span><span> </span><span id="local-6989586621680810498"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810498"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; Maybe [ArgStr]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ArgStr -&gt; [ArgStr]
forall a. Int -&gt; a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#replicate"><span class="hs-identifier hs-var">replicate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810498"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#strBot"><span class="hs-identifier hs-var">strBot</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-313"></span><span class="annot"><a href="GHC.Types.Demand.html#splitStrProdDmd"><span class="hs-identifier hs-var">splitStrProdDmd</span></a></span><span> </span><span id="local-6989586621680810497"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810497"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; Maybe [ArgStr]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ArgStr -&gt; [ArgStr]
forall a. Int -&gt; a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#replicate"><span class="hs-identifier hs-var">replicate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810497"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#strTop"><span class="hs-identifier hs-var">strTop</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-314"></span><span class="annot"><a href="GHC.Types.Demand.html#splitStrProdDmd"><span class="hs-identifier hs-var">splitStrProdDmd</span></a></span><span> </span><span id="local-6989586621680810496"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810496"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span id="local-6989586621680810495"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810495"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">WARN</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ds</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">lengthIs</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">n</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-315"></span><span>                                     </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;splitStrProdDmd&quot;</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">n</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">ds</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-316"></span><span>                               </span><span class="annot"><span class="annottext">[ArgStr] -&gt; Maybe [ArgStr]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810495"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-317"></span><span class="annot"><a href="GHC.Types.Demand.html#splitStrProdDmd"><span class="hs-identifier hs-var">splitStrProdDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe [ArgStr]
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-318"></span><span>      </span><span class="hs-comment">-- This can happen when the programmer uses unsafeCoerce,</span><span>
</span><span id="line-319"></span><span>      </span><span class="hs-comment">-- and we don't then want to crash the compiler (#9208)</span><span>
</span><span id="line-320"></span><span>
</span><span id="line-321"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
            Absence domain
*                                                                      *
************************************************************************

         Used
         /   \
     UCall   UProd
         \   /
         UHead
          |
  Count x -
        |
       Abs
-}</span><span>
</span><span id="line-338"></span><span>
</span><span id="line-339"></span><span class="hs-comment">-- | Domain for genuine usage</span><span>
</span><span id="line-340"></span><span class="hs-keyword">data</span><span> </span><span id="UseDmd"><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-var">UseDmd</span></a></span></span><span>
</span><span id="line-341"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="UCall"><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Count"><span class="hs-identifier hs-type">Count</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span>   </span><span class="hs-comment">-- ^ Call demand for absence.</span><span>
</span><span id="line-342"></span><span>                         </span><span class="hs-comment">-- Used only for values of function type</span><span>
</span><span id="line-343"></span><span>
</span><span id="line-344"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="UProd"><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span class="hs-special">]</span><span>       </span><span class="hs-comment">-- ^ Product.</span><span>
</span><span id="line-345"></span><span>                         </span><span class="hs-comment">-- Used only for values of product type</span><span>
</span><span id="line-346"></span><span>                         </span><span class="hs-comment">-- See Note [Don't optimise UProd(Used) to Used]</span><span>
</span><span id="line-347"></span><span>                         </span><span class="hs-comment">--</span><span>
</span><span id="line-348"></span><span>                         </span><span class="hs-comment">-- Invariant: Not all components are Abs</span><span>
</span><span id="line-349"></span><span>                         </span><span class="hs-comment">-- (in that case, use UHead)</span><span>
</span><span id="line-350"></span><span>
</span><span id="line-351"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="UHead"><span class="annot"><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span></span><span>                </span><span class="hs-comment">-- ^ May be used but its sub-components are</span><span>
</span><span id="line-352"></span><span>                         </span><span class="hs-comment">-- definitely *not* used.  For product types, UHead</span><span>
</span><span id="line-353"></span><span>                         </span><span class="hs-comment">-- is equivalent to U(AAA); see mkUProd.</span><span>
</span><span id="line-354"></span><span>                         </span><span class="hs-comment">--</span><span>
</span><span id="line-355"></span><span>                         </span><span class="hs-comment">-- UHead is needed only to express the demand</span><span>
</span><span id="line-356"></span><span>                         </span><span class="hs-comment">-- of 'seq' and 'case' which are polymorphic;</span><span>
</span><span id="line-357"></span><span>                         </span><span class="hs-comment">-- i.e. the scrutinised value is of type 'a'</span><span>
</span><span id="line-358"></span><span>                         </span><span class="hs-comment">-- rather than a product type. That's why we</span><span>
</span><span id="line-359"></span><span>                         </span><span class="hs-comment">-- can't use UProd [A,A,A]</span><span>
</span><span id="line-360"></span><span>                         </span><span class="hs-comment">--</span><span>
</span><span id="line-361"></span><span>                         </span><span class="hs-comment">-- Since (UCall _ Abs) is ill-typed, UHead doesn't</span><span>
</span><span id="line-362"></span><span>                         </span><span class="hs-comment">-- make sense for lambdas</span><span>
</span><span id="line-363"></span><span>
</span><span id="line-364"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Used"><span class="annot"><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span></span><span>                 </span><span class="hs-comment">-- ^ May be used and its sub-components may be used.</span><span>
</span><span id="line-365"></span><span>                         </span><span class="hs-comment">-- (top of the lattice)</span><span>
</span><span id="line-366"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span> </span><span id="local-6989586621680810479"><span id="local-6989586621680810484"><span class="annot"><span class="annottext">UseDmd -&gt; UseDmd -&gt; Bool
(UseDmd -&gt; UseDmd -&gt; Bool)
-&gt; (UseDmd -&gt; UseDmd -&gt; Bool) -&gt; Eq UseDmd
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: UseDmd -&gt; UseDmd -&gt; Bool
$c/= :: UseDmd -&gt; UseDmd -&gt; Bool
== :: UseDmd -&gt; UseDmd -&gt; Bool
$c== :: UseDmd -&gt; UseDmd -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810467"><span id="local-6989586621680810469"><span id="local-6989586621680810477"><span class="annot"><span class="annottext">Int -&gt; UseDmd -&gt; ShowS
[UseDmd] -&gt; ShowS
UseDmd -&gt; String
(Int -&gt; UseDmd -&gt; ShowS)
-&gt; (UseDmd -&gt; String) -&gt; ([UseDmd] -&gt; ShowS) -&gt; Show UseDmd
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [UseDmd] -&gt; ShowS
$cshowList :: [UseDmd] -&gt; ShowS
show :: UseDmd -&gt; String
$cshow :: UseDmd -&gt; String
showsPrec :: Int -&gt; UseDmd -&gt; ShowS
$cshowsPrec :: Int -&gt; UseDmd -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-367"></span><span>
</span><span id="line-368"></span><span class="hs-comment">-- Extended usage demand for absence and counting</span><span>
</span><span id="line-369"></span><span class="hs-keyword">type</span><span> </span><span id="ArgUse"><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-var">ArgUse</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span>
</span><span id="line-370"></span><span>
</span><span id="line-371"></span><span class="hs-keyword">data</span><span> </span><span id="Use"><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span></span><span> </span><span id="local-6989586621680811039"><span class="annot"><a href="#local-6989586621680811039"><span class="hs-identifier hs-type">u</span></a></span></span><span>
</span><span id="line-372"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="Abs"><span class="annot"><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span></span><span>             </span><span class="hs-comment">-- Definitely unused</span><span>
</span><span id="line-373"></span><span>                    </span><span class="hs-comment">-- Bottom of the lattice</span><span>
</span><span id="line-374"></span><span>
</span><span id="line-375"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Use"><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Count"><span class="hs-identifier hs-type">Count</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680811039"><span class="hs-identifier hs-type">u</span></a></span><span>     </span><span class="hs-comment">-- May be used with some cardinality</span><span>
</span><span id="line-376"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span> </span><span id="local-6989586621680810459"><span id="local-6989586621680810463"><span class="annot"><span class="annottext">Use u -&gt; Use u -&gt; Bool
(Use u -&gt; Use u -&gt; Bool) -&gt; (Use u -&gt; Use u -&gt; Bool) -&gt; Eq (Use u)
forall u. Eq u =&gt; Use u -&gt; Use u -&gt; Bool
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: Use u -&gt; Use u -&gt; Bool
$c/= :: forall u. Eq u =&gt; Use u -&gt; Use u -&gt; Bool
== :: Use u -&gt; Use u -&gt; Bool
$c== :: forall u. Eq u =&gt; Use u -&gt; Use u -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810450"><span id="local-6989586621680810452"><span id="local-6989586621680810457"><span class="annot"><span class="annottext">Int -&gt; Use u -&gt; ShowS
[Use u] -&gt; ShowS
Use u -&gt; String
(Int -&gt; Use u -&gt; ShowS)
-&gt; (Use u -&gt; String) -&gt; ([Use u] -&gt; ShowS) -&gt; Show (Use u)
forall u. Show u =&gt; Int -&gt; Use u -&gt; ShowS
forall u. Show u =&gt; [Use u] -&gt; ShowS
forall u. Show u =&gt; Use u -&gt; String
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [Use u] -&gt; ShowS
$cshowList :: forall u. Show u =&gt; [Use u] -&gt; ShowS
show :: Use u -&gt; String
$cshow :: forall u. Show u =&gt; Use u -&gt; String
showsPrec :: Int -&gt; Use u -&gt; ShowS
$cshowsPrec :: forall u. Show u =&gt; Int -&gt; Use u -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-377"></span><span>
</span><span id="line-378"></span><span class="hs-comment">-- | Abstract counting of usages</span><span>
</span><span id="line-379"></span><span class="hs-keyword">data</span><span> </span><span id="Count"><span class="annot"><a href="GHC.Types.Demand.html#Count"><span class="hs-identifier hs-var">Count</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="One"><span class="annot"><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="Many"><span class="annot"><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span></span><span>
</span><span id="line-380"></span><span>  </span><span class="hs-keyword">deriving</span><span> </span><span class="hs-special">(</span><span> </span><span id="local-6989586621680810444"><span id="local-6989586621680810446"><span class="annot"><span class="annottext">Count -&gt; Count -&gt; Bool
(Count -&gt; Count -&gt; Bool) -&gt; (Count -&gt; Count -&gt; Bool) -&gt; Eq Count
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: Count -&gt; Count -&gt; Bool
$c/= :: Count -&gt; Count -&gt; Bool
== :: Count -&gt; Count -&gt; Bool
$c== :: Count -&gt; Count -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810438"><span id="local-6989586621680810440"><span id="local-6989586621680810442"><span class="annot"><span class="annottext">Int -&gt; Count -&gt; ShowS
[Count] -&gt; ShowS
Count -&gt; String
(Int -&gt; Count -&gt; ShowS)
-&gt; (Count -&gt; String) -&gt; ([Count] -&gt; ShowS) -&gt; Show Count
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [Count] -&gt; ShowS
$cshowList :: [Count] -&gt; ShowS
show :: Count -&gt; String
$cshow :: Count -&gt; String
showsPrec :: Int -&gt; Count -&gt; ShowS
$cshowsPrec :: Int -&gt; Count -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-381"></span><span>
</span><span id="line-382"></span><span class="hs-comment">-- Pretty-printing</span><span>
</span><span id="line-383"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680810435"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-384"></span><span>  </span><span id="local-6989586621680810432"><span class="annot"><span class="annottext">ppr :: ArgUse -&gt; SDoc
</span><a href="#local-6989586621680810432"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'A'</span></span><span>
</span><span id="line-385"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span id="local-6989586621680810431"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810431"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810431"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-386"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span>  </span><span id="local-6989586621680810430"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810430"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'1'</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'*'</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810430"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-387"></span><span>
</span><span id="line-388"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680810427"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-389"></span><span>  </span><span id="local-6989586621680810423"><span class="annot"><span class="annottext">ppr :: UseDmd -&gt; SDoc
</span><a href="#local-6989586621680810423"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'U'</span></span><span>
</span><span id="line-390"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span id="local-6989586621680810422"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810422"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680810421"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810421"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'C'</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Count -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810422"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UseDmd -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810421"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-391"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'H'</span></span><span>
</span><span id="line-392"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810420"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810420"><span class="hs-keyword hs-var">as</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'U'</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hcat"><span class="hs-identifier hs-var">hcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; [SDoc] -&gt; [SDoc]
</span><a href="GHC.Utils.Outputable.html#punctuate"><span class="hs-identifier hs-var">punctuate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">','</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgUse -&gt; SDoc) -&gt; [ArgUse] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810420"><span class="hs-keyword hs-var">as</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-393"></span><span>
</span><span id="line-394"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680810416"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Count"><span class="hs-identifier hs-type">Count</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-395"></span><span>  </span><span id="local-6989586621680810415"><span class="annot"><span class="annottext">ppr :: Count -&gt; SDoc
</span><a href="#local-6989586621680810415"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'1'</span></span><span>
</span><span id="line-396"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;&quot;</span></span><span>
</span><span id="line-397"></span><span>
</span><span id="line-398"></span><span class="annot"><a href="GHC.Types.Demand.html#useBot"><span class="hs-identifier hs-type">useBot</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#useTop"><span class="hs-identifier hs-type">useTop</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span>
</span><span id="line-399"></span><span id="useBot"><span class="annot"><span class="annottext">useBot :: ArgUse
</span><a href="GHC.Types.Demand.html#useBot"><span class="hs-identifier hs-var hs-var">useBot</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
forall u. Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>
</span><span id="line-400"></span><span id="useTop"><span class="annot"><span class="annottext">useTop :: ArgUse
</span><a href="GHC.Types.Demand.html#useTop"><span class="hs-identifier hs-var hs-var">useTop</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>
</span><span id="line-401"></span><span>
</span><span id="line-402"></span><span class="annot"><a href="GHC.Types.Demand.html#mkUCall"><span class="hs-identifier hs-type">mkUCall</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Count"><span class="hs-identifier hs-type">Count</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span>
</span><span id="line-403"></span><span class="hs-comment">--mkUCall c Used = Used c</span><span>
</span><span id="line-404"></span><span id="mkUCall"><span class="annot"><span class="annottext">mkUCall :: Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#mkUCall"><span class="hs-identifier hs-var hs-var">mkUCall</span></a></span></span><span> </span><span id="local-6989586621680810411"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810411"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680810410"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810410"><span class="hs-identifier hs-var">a</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810411"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810410"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-405"></span><span>
</span><span id="line-406"></span><span class="annot"><a href="GHC.Types.Demand.html#mkUProd"><span class="hs-identifier hs-type">mkUProd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span>
</span><span id="line-407"></span><span id="mkUProd"><span class="annot"><span class="annottext">mkUProd :: [ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#mkUProd"><span class="hs-identifier hs-var hs-var">mkUProd</span></a></span></span><span> </span><span id="local-6989586621680810408"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810408"><span class="hs-identifier hs-var">ux</span></a></span></span><span>
</span><span id="line-408"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">(ArgUse -&gt; Bool) -&gt; [ArgUse] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgUse -&gt; ArgUse -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">ArgUse
forall u. Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810408"><span class="hs-identifier hs-var">ux</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>
</span><span id="line-409"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810408"><span class="hs-identifier hs-var">ux</span></a></span><span>
</span><span id="line-410"></span><span>
</span><span id="line-411"></span><span class="annot"><a href="GHC.Types.Demand.html#lubCount"><span class="hs-identifier hs-type">lubCount</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Count"><span class="hs-identifier hs-type">Count</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Count"><span class="hs-identifier hs-type">Count</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Count"><span class="hs-identifier hs-type">Count</span></a></span><span>
</span><span id="line-412"></span><span id="lubCount"><span class="annot"><span class="annottext">lubCount :: Count -&gt; Count -&gt; Count
</span><a href="GHC.Types.Demand.html#lubCount"><span class="hs-identifier hs-var hs-var">lubCount</span></a></span></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span>
</span><span id="line-413"></span><span class="annot"><a href="GHC.Types.Demand.html#lubCount"><span class="hs-identifier hs-var">lubCount</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span>
</span><span id="line-414"></span><span class="annot"><a href="GHC.Types.Demand.html#lubCount"><span class="hs-identifier hs-var">lubCount</span></a></span><span> </span><span id="local-6989586621680810406"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810406"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810406"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-415"></span><span>
</span><span id="line-416"></span><span class="annot"><a href="GHC.Types.Demand.html#lubArgUse"><span class="hs-identifier hs-type">lubArgUse</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span>
</span><span id="line-417"></span><span id="lubArgUse"><span class="annot"><span class="annottext">lubArgUse :: ArgUse -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#lubArgUse"><span class="hs-identifier hs-var hs-var">lubArgUse</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span> </span><span id="local-6989586621680810404"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810404"><span class="hs-identifier hs-var">x</span></a></span></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810404"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-418"></span><span class="annot"><a href="GHC.Types.Demand.html#lubArgUse"><span class="hs-identifier hs-var">lubArgUse</span></a></span><span> </span><span id="local-6989586621680810403"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810403"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810403"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-419"></span><span class="annot"><a href="GHC.Types.Demand.html#lubArgUse"><span class="hs-identifier hs-var">lubArgUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span id="local-6989586621680810402"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810402"><span class="hs-identifier hs-var">c1</span></a></span></span><span> </span><span id="local-6989586621680810401"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810401"><span class="hs-identifier hs-var">a1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span id="local-6989586621680810400"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810400"><span class="hs-identifier hs-var">c2</span></a></span></span><span> </span><span id="local-6989586621680810399"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810399"><span class="hs-identifier hs-var">a2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Count -&gt; Count -&gt; Count
</span><a href="GHC.Types.Demand.html#lubCount"><span class="hs-identifier hs-var">lubCount</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810402"><span class="hs-identifier hs-var">c1</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810400"><span class="hs-identifier hs-var">c2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UseDmd -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-var">lubUse</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810401"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810399"><span class="hs-identifier hs-var">a2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-420"></span><span>
</span><span id="line-421"></span><span class="annot"><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-type">lubUse</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span>
</span><span id="line-422"></span><span id="lubUse"><span class="annot"><span class="annottext">lubUse :: UseDmd -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-var hs-var">lubUse</span></a></span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>       </span><span id="local-6989586621680810397"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810397"><span class="hs-identifier hs-var">u</span></a></span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810397"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-423"></span><span class="annot"><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-var">lubUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span id="local-6989586621680810396"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810396"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680810395"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810395"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810396"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810395"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-424"></span><span class="annot"><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-var">lubUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span id="local-6989586621680810394"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810394"><span class="hs-identifier hs-var">c1</span></a></span></span><span> </span><span id="local-6989586621680810393"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810393"><span class="hs-identifier hs-var">u1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span id="local-6989586621680810392"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810392"><span class="hs-identifier hs-var">c2</span></a></span></span><span> </span><span id="local-6989586621680810391"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810391"><span class="hs-identifier hs-var">u2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Count -&gt; Count -&gt; Count
</span><a href="GHC.Types.Demand.html#lubCount"><span class="hs-identifier hs-var">lubCount</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810394"><span class="hs-identifier hs-var">c1</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810392"><span class="hs-identifier hs-var">c2</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UseDmd -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-var">lubUse</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810393"><span class="hs-identifier hs-var">u1</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810391"><span class="hs-identifier hs-var">u2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-425"></span><span class="annot"><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-var">lubUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>
</span><span id="line-426"></span><span class="annot"><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-var">lubUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810390"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810390"><span class="hs-identifier hs-var">ux</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810390"><span class="hs-identifier hs-var">ux</span></a></span><span>
</span><span id="line-427"></span><span class="annot"><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-var">lubUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810389"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810389"><span class="hs-identifier hs-var">ux1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810388"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810388"><span class="hs-identifier hs-var">ux2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-428"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810389"><span class="hs-identifier hs-var">ux1</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; [ArgUse] -&gt; Bool
forall a b. [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-operator hs-var">`equalLength`</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810388"><span class="hs-identifier hs-var">ux2</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="annot"><span class="annottext">([ArgUse] -&gt; UseDmd) -&gt; [ArgUse] -&gt; UseDmd
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(ArgUse -&gt; ArgUse -&gt; ArgUse) -&gt; [ArgUse] -&gt; [ArgUse] -&gt; [ArgUse]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#lubArgUse"><span class="hs-identifier hs-var">lubArgUse</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810389"><span class="hs-identifier hs-var">ux1</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810388"><span class="hs-identifier hs-var">ux2</span></a></span><span>
</span><span id="line-429"></span><span>     </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>
</span><span id="line-430"></span><span class="annot"><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-var">lubUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>
</span><span id="line-431"></span><span class="hs-comment">-- lubUse (UProd {}) Used             = Used</span><span>
</span><span id="line-432"></span><span class="annot"><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-var">lubUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810387"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810387"><span class="hs-identifier hs-var">ux</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgUse -&gt; ArgUse) -&gt; [ArgUse] -&gt; [ArgUse]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgUse -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#lubArgUse"><span class="hs-operator hs-var">`lubArgUse`</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#useTop"><span class="hs-identifier hs-var">useTop</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810387"><span class="hs-identifier hs-var">ux</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-433"></span><span class="annot"><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-var">lubUse</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>       </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810386"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810386"><span class="hs-identifier hs-var">ux</span></a></span></span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgUse -&gt; ArgUse) -&gt; [ArgUse] -&gt; [ArgUse]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgUse -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#lubArgUse"><span class="hs-operator hs-var">`lubArgUse`</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#useTop"><span class="hs-identifier hs-var">useTop</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810386"><span class="hs-identifier hs-var">ux</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-434"></span><span class="annot"><a href="GHC.Types.Demand.html#lubUse"><span class="hs-identifier hs-var">lubUse</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>  </span><span class="hs-comment">-- Note [Used should win]</span><span>
</span><span id="line-435"></span><span>
</span><span id="line-436"></span><span class="hs-comment">-- `both` is different from `lub` in its treatment of counting; if</span><span>
</span><span id="line-437"></span><span class="hs-comment">-- `both` is computed for two used, the result always has</span><span>
</span><span id="line-438"></span><span class="hs-comment">--  cardinality `Many` (except for the inner demands of UCall demand -- [TODO] explain).</span><span>
</span><span id="line-439"></span><span class="hs-comment">--  Also,  x `bothUse` x /= x (for anything but Abs).</span><span>
</span><span id="line-440"></span><span>
</span><span id="line-441"></span><span class="annot"><a href="GHC.Types.Demand.html#bothArgUse"><span class="hs-identifier hs-type">bothArgUse</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span>
</span><span id="line-442"></span><span id="bothArgUse"><span class="annot"><span class="annottext">bothArgUse :: ArgUse -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#bothArgUse"><span class="hs-identifier hs-var hs-var">bothArgUse</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span> </span><span id="local-6989586621680810384"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810384"><span class="hs-identifier hs-var">x</span></a></span></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810384"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-443"></span><span class="annot"><a href="GHC.Types.Demand.html#bothArgUse"><span class="hs-identifier hs-var">bothArgUse</span></a></span><span> </span><span id="local-6989586621680810383"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810383"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810383"><span class="hs-identifier hs-var">x</span></a></span><span>
</span><span id="line-444"></span><span class="annot"><a href="GHC.Types.Demand.html#bothArgUse"><span class="hs-identifier hs-var">bothArgUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810382"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810382"><span class="hs-identifier hs-var">a1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810381"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810381"><span class="hs-identifier hs-var">a2</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UseDmd -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#bothUse"><span class="hs-identifier hs-var">bothUse</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810382"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810381"><span class="hs-identifier hs-var">a2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-445"></span><span>
</span><span id="line-446"></span><span>
</span><span id="line-447"></span><span class="annot"><a href="GHC.Types.Demand.html#bothUse"><span class="hs-identifier hs-type">bothUse</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span>
</span><span id="line-448"></span><span id="bothUse"><span class="annot"><span class="annottext">bothUse :: UseDmd -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#bothUse"><span class="hs-identifier hs-var hs-var">bothUse</span></a></span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>       </span><span id="local-6989586621680810379"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810379"><span class="hs-identifier hs-var">u</span></a></span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810379"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-449"></span><span class="annot"><a href="GHC.Types.Demand.html#bothUse"><span class="hs-identifier hs-var">bothUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span id="local-6989586621680810378"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810378"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680810377"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810377"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810378"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810377"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-450"></span><span>
</span><span id="line-451"></span><span class="hs-comment">-- Exciting special treatment of inner demand for call demands:</span><span>
</span><span id="line-452"></span><span class="hs-comment">--    use `lubUse` instead of `bothUse`!</span><span>
</span><span id="line-453"></span><span class="annot"><a href="GHC.Types.Demand.html#bothUse"><span class="hs-identifier hs-var">bothUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810376"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810376"><span class="hs-identifier hs-var">u1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810375"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810375"><span class="hs-identifier hs-var">u2</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810376"><span class="hs-identifier hs-var">u1</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#lubUse"><span class="hs-operator hs-var">`lubUse`</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810375"><span class="hs-identifier hs-var">u2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-454"></span><span>
</span><span id="line-455"></span><span class="annot"><a href="GHC.Types.Demand.html#bothUse"><span class="hs-identifier hs-var">bothUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>
</span><span id="line-456"></span><span class="annot"><a href="GHC.Types.Demand.html#bothUse"><span class="hs-identifier hs-var">bothUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810374"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810374"><span class="hs-identifier hs-var">ux</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810374"><span class="hs-identifier hs-var">ux</span></a></span><span>
</span><span id="line-457"></span><span class="annot"><a href="GHC.Types.Demand.html#bothUse"><span class="hs-identifier hs-var">bothUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810373"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810373"><span class="hs-identifier hs-var">ux1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810372"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810372"><span class="hs-identifier hs-var">ux2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-458"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810373"><span class="hs-identifier hs-var">ux1</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; [ArgUse] -&gt; Bool
forall a b. [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-operator hs-var">`equalLength`</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810372"><span class="hs-identifier hs-var">ux2</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="annot"><span class="annottext">([ArgUse] -&gt; UseDmd) -&gt; [ArgUse] -&gt; UseDmd
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(ArgUse -&gt; ArgUse -&gt; ArgUse) -&gt; [ArgUse] -&gt; [ArgUse] -&gt; [ArgUse]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#bothArgUse"><span class="hs-identifier hs-var">bothArgUse</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810373"><span class="hs-identifier hs-var">ux1</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810372"><span class="hs-identifier hs-var">ux2</span></a></span><span>
</span><span id="line-459"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>
</span><span id="line-460"></span><span class="annot"><a href="GHC.Types.Demand.html#bothUse"><span class="hs-identifier hs-var">bothUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>
</span><span id="line-461"></span><span class="hs-comment">-- bothUse (UProd {}) Used             = Used  -- Note [Used should win]</span><span>
</span><span id="line-462"></span><span class="annot"><a href="GHC.Types.Demand.html#bothUse"><span class="hs-identifier hs-var">bothUse</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810371"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810371"><span class="hs-identifier hs-var">ux</span></a></span></span><span class="hs-special">)</span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgUse -&gt; ArgUse) -&gt; [ArgUse] -&gt; [ArgUse]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgUse -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#bothArgUse"><span class="hs-operator hs-var">`bothArgUse`</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#useTop"><span class="hs-identifier hs-var">useTop</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810371"><span class="hs-identifier hs-var">ux</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-463"></span><span class="annot"><a href="GHC.Types.Demand.html#bothUse"><span class="hs-identifier hs-var">bothUse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810370"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810370"><span class="hs-identifier hs-var">ux</span></a></span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgUse -&gt; ArgUse) -&gt; [ArgUse] -&gt; [ArgUse]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgUse -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#bothArgUse"><span class="hs-operator hs-var">`bothArgUse`</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#useTop"><span class="hs-identifier hs-var">useTop</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810370"><span class="hs-identifier hs-var">ux</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-464"></span><span class="annot"><a href="GHC.Types.Demand.html#bothUse"><span class="hs-identifier hs-var">bothUse</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>  </span><span class="hs-comment">-- Note [Used should win]</span><span>
</span><span id="line-465"></span><span>
</span><span id="line-466"></span><span class="annot"><a href="GHC.Types.Demand.html#peelUseCall"><span class="hs-identifier hs-type">peelUseCall</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Count"><span class="hs-identifier hs-type">Count</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-467"></span><span id="peelUseCall"><span class="annot"><span class="annottext">peelUseCall :: UseDmd -&gt; Maybe (Count, UseDmd)
</span><a href="GHC.Types.Demand.html#peelUseCall"><span class="hs-identifier hs-var hs-var">peelUseCall</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span id="local-6989586621680810369"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810369"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680810368"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810368"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Count, UseDmd) -&gt; Maybe (Count, UseDmd)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810369"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810368"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-468"></span><span class="annot"><a href="GHC.Types.Demand.html#peelUseCall"><span class="hs-identifier hs-var">peelUseCall</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Count, UseDmd)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-469"></span><span>
</span><span id="line-470"></span><span class="annot"><a href="GHC.Types.Demand.html#addCaseBndrDmd"><span class="hs-identifier hs-type">addCaseBndrDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>    </span><span class="hs-comment">-- On the case binder</span><span>
</span><span id="line-471"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- On the components of the constructor</span><span>
</span><span id="line-472"></span><span>               </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- Final demands for the components of the constructor</span><span>
</span><span id="line-473"></span><span class="hs-comment">-- See Note [Demand on case-alternative binders]</span><span>
</span><span id="line-474"></span><span id="addCaseBndrDmd"><span class="annot"><span class="annottext">addCaseBndrDmd :: Demand -&gt; [Demand] -&gt; [Demand]
</span><a href="GHC.Types.Demand.html#addCaseBndrDmd"><span class="hs-identifier hs-var hs-var">addCaseBndrDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810367"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810367"><span class="hs-identifier hs-var">ms</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810366"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810366"><span class="hs-identifier hs-var">mu</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680810365"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810365"><span class="hs-identifier hs-var">alt_dmds</span></a></span></span><span>
</span><span id="line-475"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810366"><span class="hs-identifier hs-var">mu</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-476"></span><span>     </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810365"><span class="hs-identifier hs-var">alt_dmds</span></a></span><span>
</span><span id="line-477"></span><span>     </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810364"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810364"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Demand -&gt; Demand -&gt; Demand) -&gt; [Demand] -&gt; [Demand] -&gt; [Demand]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#bothDmd"><span class="hs-identifier hs-var">bothDmd</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810365"><span class="hs-identifier hs-var">alt_dmds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ArgStr] -&gt; [ArgUse] -&gt; [Demand]
forall s u. [s] -&gt; [u] -&gt; [JointDmd s u]
</span><a href="GHC.Types.Demand.html#mkJointDmds"><span class="hs-identifier hs-var">mkJointDmds</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810363"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810362"><span class="hs-identifier hs-var">us</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-478"></span><span>             </span><span class="hs-keyword">where</span><span>
</span><span id="line-479"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680810363"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810363"><span class="hs-identifier hs-var">ss</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; ArgStr -&gt; Maybe [ArgStr]
</span><a href="GHC.Types.Demand.html#splitArgStrProdDmd"><span class="hs-identifier hs-var">splitArgStrProdDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810361"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810367"><span class="hs-identifier hs-var">ms</span></a></span><span>  </span><span class="hs-comment">-- Guaranteed not to be a call</span><span>
</span><span id="line-480"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680810362"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810362"><span class="hs-identifier hs-var">us</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; UseDmd -&gt; Maybe [ArgUse]
</span><a href="GHC.Types.Demand.html#splitUseProdDmd"><span class="hs-identifier hs-var">splitUseProdDmd</span></a></span><span>      </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810361"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810364"><span class="hs-identifier hs-var">u</span></a></span><span>   </span><span class="hs-comment">-- Ditto</span><span>
</span><span id="line-481"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-482"></span><span>    </span><span id="local-6989586621680810361"><span class="annot"><span class="annottext">arity :: Int
</span><a href="#local-6989586621680810361"><span class="hs-identifier hs-var hs-var">arity</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810365"><span class="hs-identifier hs-var">alt_dmds</span></a></span><span>
</span><span id="line-483"></span><span>
</span><span id="line-484"></span><span class="hs-comment">{- Note [Demand on case-alternative binders]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The demand on a binder in a case alternative comes
  (a) From the demand on the binder itself
  (b) From the demand on the case binder
Forgetting (b) led directly to #10148.

Example. Source code:
  f x@(p,_) = if p then foo x else True

  foo (p,True) = True
  foo (p,q)    = foo (q,p)

After strictness analysis:
  f = \ (x_an1 [Dmd=&lt;S(SL),1*U(U,1*U)&gt;] :: (Bool, Bool)) -&gt;
      case x_an1
      of wild_X7 [Dmd=&lt;L,1*U(1*U,1*U)&gt;]
      { (p_an2 [Dmd=&lt;S,1*U&gt;], ds_dnz [Dmd=&lt;L,A&gt;]) -&gt;
      case p_an2 of _ {
        False -&gt; GHC.Types.True;
        True -&gt; foo wild_X7 }

It's true that ds_dnz is *itself* absent, but the use of wild_X7 means
that it is very much alive and demanded.  See #10148 for how the
consequences play out.

This is needed even for non-product types, in case the case-binder
is used but the components of the case alternative are not.

Note [Don't optimise UProd(Used) to Used]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These two UseDmds:
   UProd [Used, Used]   and    Used
are semantically equivalent, but we do not turn the former into
the latter, for a regrettable-subtle reason.  Suppose we did.
then
  f (x,y) = (y,x)
would get
  StrDmd = Str  = SProd [Lazy, Lazy]
  UseDmd = Used = UProd [Used, Used]
But with the joint demand of &lt;Str, Used&gt; doesn't convey any clue
that there is a product involved, and so the worthSplittingFun
will not fire.  (We'd need to use the type as well to make it fire.)
Moreover, consider
  g h p@(_,_) = h p
This too would get &lt;Str, Used&gt;, but this time there really isn't any
point in w/w since the components of the pair are not used at all.

So the solution is: don't aggressively collapse UProd [Used,Used] to
Used; instead leave it as-is. In effect we are using the UseDmd to do a
little bit of boxity analysis.  Not very nice.

Note [Used should win]
~~~~~~~~~~~~~~~~~~~~~~
Both in lubUse and bothUse we want (Used `both` UProd us) to be Used.
Why?  Because Used carries the implication the whole thing is used,
box and all, so we don't want to w/w it.  If we use it both boxed and
unboxed, then we are definitely using the box, and so we are quite
likely to pay a reboxing cost.  So we make Used win here.

Example is in the Buffer argument of GHC.IO.Handle.Internals.writeCharBuffer

Baseline: (A) Not making Used win (UProd wins)
Compare with: (B) making Used win for lub and both

            Min          -0.3%     -5.6%    -10.7%    -11.0%    -33.3%
            Max          +0.3%    +45.6%    +11.5%    +11.5%     +6.9%
 Geometric Mean          -0.0%     +0.5%     +0.3%     +0.2%     -0.8%

Baseline: (B) Making Used win for both lub and both
Compare with: (C) making Used win for both, but UProd win for lub

            Min          -0.1%     -0.3%     -7.9%     -8.0%     -6.5%
            Max          +0.1%     +1.0%    +21.0%    +21.0%     +0.5%
 Geometric Mean          +0.0%     +0.0%     -0.0%     -0.1%     -0.1%
-}</span><span>
</span><span id="line-560"></span><span>
</span><span id="line-561"></span><span class="hs-comment">-- If a demand is used multiple times (i.e. reused), than any use-once</span><span>
</span><span id="line-562"></span><span class="hs-comment">-- mentioned there, that is not protected by a UCall, can happen many times.</span><span>
</span><span id="line-563"></span><span class="annot"><a href="GHC.Types.Demand.html#markReusedDmd"><span class="hs-identifier hs-type">markReusedDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span>
</span><span id="line-564"></span><span id="markReusedDmd"><span class="annot"><span class="annottext">markReusedDmd :: ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#markReusedDmd"><span class="hs-identifier hs-var hs-var">markReusedDmd</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
forall u. Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>
</span><span id="line-565"></span><span class="annot"><a href="GHC.Types.Demand.html#markReusedDmd"><span class="hs-identifier hs-var">markReusedDmd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810356"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810356"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#markReused"><span class="hs-identifier hs-var">markReused</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810356"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-566"></span><span>
</span><span id="line-567"></span><span class="annot"><a href="GHC.Types.Demand.html#markReused"><span class="hs-identifier hs-type">markReused</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span>
</span><span id="line-568"></span><span id="markReused"><span class="annot"><span class="annottext">markReused :: UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#markReused"><span class="hs-identifier hs-var hs-var">markReused</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810354"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810354"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810354"><span class="hs-identifier hs-var">u</span></a></span><span>   </span><span class="hs-comment">-- No need to recurse here</span><span>
</span><span id="line-569"></span><span class="annot"><a href="GHC.Types.Demand.html#markReused"><span class="hs-identifier hs-var">markReused</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810353"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810353"><span class="hs-identifier hs-var">ux</span></a></span></span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgUse -&gt; ArgUse) -&gt; [ArgUse] -&gt; [ArgUse]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#markReusedDmd"><span class="hs-identifier hs-var">markReusedDmd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810353"><span class="hs-identifier hs-var">ux</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-570"></span><span class="annot"><a href="GHC.Types.Demand.html#markReused"><span class="hs-identifier hs-var">markReused</span></a></span><span> </span><span id="local-6989586621680810352"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810352"><span class="hs-identifier hs-var">u</span></a></span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810352"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-571"></span><span>
</span><span id="line-572"></span><span class="annot"><a href="GHC.Types.Demand.html#isUsedMU"><span class="hs-identifier hs-type">isUsedMU</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-573"></span><span class="hs-comment">-- True &lt;=&gt; markReusedDmd d = d</span><span>
</span><span id="line-574"></span><span id="isUsedMU"><span class="annot"><span class="annottext">isUsedMU :: ArgUse -&gt; Bool
</span><a href="GHC.Types.Demand.html#isUsedMU"><span class="hs-identifier hs-var hs-var">isUsedMU</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-575"></span><span class="annot"><a href="GHC.Types.Demand.html#isUsedMU"><span class="hs-identifier hs-var">isUsedMU</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-576"></span><span class="annot"><a href="GHC.Types.Demand.html#isUsedMU"><span class="hs-identifier hs-var">isUsedMU</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span id="local-6989586621680810350"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810350"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; Bool
</span><a href="GHC.Types.Demand.html#isUsedU"><span class="hs-identifier hs-var">isUsedU</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810350"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-577"></span><span>
</span><span id="line-578"></span><span class="annot"><a href="GHC.Types.Demand.html#isUsedU"><span class="hs-identifier hs-type">isUsedU</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-579"></span><span class="hs-comment">-- True &lt;=&gt; markReused d = d</span><span>
</span><span id="line-580"></span><span id="isUsedU"><span class="annot"><span class="annottext">isUsedU :: UseDmd -&gt; Bool
</span><a href="GHC.Types.Demand.html#isUsedU"><span class="hs-identifier hs-var hs-var">isUsedU</span></a></span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-581"></span><span class="annot"><a href="GHC.Types.Demand.html#isUsedU"><span class="hs-identifier hs-var">isUsedU</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-582"></span><span class="annot"><a href="GHC.Types.Demand.html#isUsedU"><span class="hs-identifier hs-var">isUsedU</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810348"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810348"><span class="hs-identifier hs-var">us</span></a></span></span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ArgUse -&gt; Bool) -&gt; [ArgUse] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; Bool
</span><a href="GHC.Types.Demand.html#isUsedMU"><span class="hs-identifier hs-var">isUsedMU</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810348"><span class="hs-identifier hs-var">us</span></a></span><span>
</span><span id="line-583"></span><span class="annot"><a href="GHC.Types.Demand.html#isUsedU"><span class="hs-identifier hs-var">isUsedU</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-584"></span><span class="annot"><a href="GHC.Types.Demand.html#isUsedU"><span class="hs-identifier hs-var">isUsedU</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>  </span><span class="hs-comment">-- No need to recurse</span><span>
</span><span id="line-585"></span><span>
</span><span id="line-586"></span><span class="hs-comment">-- Squashing usage demand demands</span><span>
</span><span id="line-587"></span><span class="annot"><a href="GHC.Types.Demand.html#seqUseDmd"><span class="hs-identifier hs-type">seqUseDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-588"></span><span id="seqUseDmd"><span class="annot"><span class="annottext">seqUseDmd :: UseDmd -&gt; ()
</span><a href="GHC.Types.Demand.html#seqUseDmd"><span class="hs-identifier hs-var hs-var">seqUseDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810346"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810346"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; ()
</span><a href="GHC.Types.Demand.html#seqArgUseList"><span class="hs-identifier hs-var">seqArgUseList</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810346"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-589"></span><span class="annot"><a href="GHC.Types.Demand.html#seqUseDmd"><span class="hs-identifier hs-var">seqUseDmd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span id="local-6989586621680810344"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810344"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680810343"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810343"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810344"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Count -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; ()
</span><a href="GHC.Types.Demand.html#seqUseDmd"><span class="hs-identifier hs-var">seqUseDmd</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810343"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-590"></span><span class="annot"><a href="GHC.Types.Demand.html#seqUseDmd"><span class="hs-identifier hs-var">seqUseDmd</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-591"></span><span>
</span><span id="line-592"></span><span class="annot"><a href="GHC.Types.Demand.html#seqArgUseList"><span class="hs-identifier hs-type">seqArgUseList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-593"></span><span id="seqArgUseList"><span class="annot"><span class="annottext">seqArgUseList :: [ArgUse] -&gt; ()
</span><a href="GHC.Types.Demand.html#seqArgUseList"><span class="hs-identifier hs-var hs-var">seqArgUseList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-594"></span><span class="annot"><a href="GHC.Types.Demand.html#seqArgUseList"><span class="hs-identifier hs-var">seqArgUseList</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680810342"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810342"><span class="hs-identifier hs-var">d</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680810341"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810341"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; ()
</span><a href="GHC.Types.Demand.html#seqArgUse"><span class="hs-identifier hs-var">seqArgUse</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810342"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; ()
</span><a href="GHC.Types.Demand.html#seqArgUseList"><span class="hs-identifier hs-var">seqArgUseList</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810341"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-595"></span><span>
</span><span id="line-596"></span><span class="annot"><a href="GHC.Types.Demand.html#seqArgUse"><span class="hs-identifier hs-type">seqArgUse</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-597"></span><span id="seqArgUse"><span class="annot"><span class="annottext">seqArgUse :: ArgUse -&gt; ()
</span><a href="GHC.Types.Demand.html#seqArgUse"><span class="hs-identifier hs-var hs-var">seqArgUse</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span id="local-6989586621680810339"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810339"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680810338"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810338"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810339"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">Count -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; ()
</span><a href="GHC.Types.Demand.html#seqUseDmd"><span class="hs-identifier hs-var">seqUseDmd</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810338"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-598"></span><span class="annot"><a href="GHC.Types.Demand.html#seqArgUse"><span class="hs-identifier hs-var">seqArgUse</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><span class="hs-identifier">_</span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-599"></span><span>
</span><span id="line-600"></span><span class="hs-comment">-- Splitting polymorphic Maybe-Used demands</span><span>
</span><span id="line-601"></span><span class="annot"><a href="GHC.Types.Demand.html#splitUseProdDmd"><span class="hs-identifier hs-type">splitUseProdDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-602"></span><span id="splitUseProdDmd"><span class="annot"><span class="annottext">splitUseProdDmd :: Int -&gt; UseDmd -&gt; Maybe [ArgUse]
</span><a href="GHC.Types.Demand.html#splitUseProdDmd"><span class="hs-identifier hs-var hs-var">splitUseProdDmd</span></a></span></span><span> </span><span id="local-6989586621680810337"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810337"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; Maybe [ArgUse]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ArgUse -&gt; [ArgUse]
forall a. Int -&gt; a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#replicate"><span class="hs-identifier hs-var">replicate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810337"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#useTop"><span class="hs-identifier hs-var">useTop</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-603"></span><span class="annot"><a href="GHC.Types.Demand.html#splitUseProdDmd"><span class="hs-identifier hs-var">splitUseProdDmd</span></a></span><span> </span><span id="local-6989586621680810336"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810336"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; Maybe [ArgUse]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ArgUse -&gt; [ArgUse]
forall a. Int -&gt; a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#replicate"><span class="hs-identifier hs-var">replicate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810336"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
forall u. Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-604"></span><span class="annot"><a href="GHC.Types.Demand.html#splitUseProdDmd"><span class="hs-identifier hs-var">splitUseProdDmd</span></a></span><span> </span><span id="local-6989586621680810335"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810335"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810334"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810334"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-identifier">WARN</span><span class="hs-special">(</span><span> </span><span class="hs-identifier">not</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">ds</span><span> </span><span class="hs-special">`</span><span class="hs-identifier">lengthIs</span><span class="hs-special">`</span><span> </span><span class="hs-identifier">n</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-605"></span><span>                                      </span><span class="hs-identifier">text</span><span> </span><span class="hs-string">&quot;splitUseProdDmd&quot;</span><span> </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">n</span><span>
</span><span id="line-606"></span><span>                                                             </span><span class="hs-operator">$$</span><span> </span><span class="hs-identifier">ppr</span><span> </span><span class="hs-identifier">ds</span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-607"></span><span>                                </span><span class="annot"><span class="annottext">[ArgUse] -&gt; Maybe [ArgUse]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810334"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-608"></span><span class="annot"><a href="GHC.Types.Demand.html#splitUseProdDmd"><span class="hs-identifier hs-var">splitUseProdDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe [ArgUse]
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-609"></span><span>      </span><span class="hs-comment">-- This can happen when the programmer uses unsafeCoerce,</span><span>
</span><span id="line-610"></span><span>      </span><span class="hs-comment">-- and we don't then want to crash the compiler (#9208)</span><span>
</span><span id="line-611"></span><span>
</span><span id="line-612"></span><span id="local-6989586621680810987"><span class="annot"><a href="GHC.Types.Demand.html#useCount"><span class="hs-identifier hs-type">useCount</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810987"><span class="hs-identifier hs-type">u</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Count"><span class="hs-identifier hs-type">Count</span></a></span></span><span>
</span><span id="line-613"></span><span id="useCount"><span class="annot"><span class="annottext">useCount :: forall u. Use u -&gt; Count
</span><a href="GHC.Types.Demand.html#useCount"><span class="hs-identifier hs-var hs-var">useCount</span></a></span></span><span> </span><span class="annot"><span class="annottext">Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span>
</span><span id="line-614"></span><span class="annot"><a href="GHC.Types.Demand.html#useCount"><span class="hs-identifier hs-var">useCount</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">u
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span>
</span><span id="line-615"></span><span class="annot"><a href="GHC.Types.Demand.html#useCount"><span class="hs-identifier hs-var">useCount</span></a></span><span> </span><span class="annot"><span class="annottext">Use u
</span><span class="hs-identifier">_</span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span>
</span><span id="line-616"></span><span>
</span><span id="line-617"></span><span>
</span><span id="line-618"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
         Clean demand for Strictness and Usage
*                                                                      *
************************************************************************

This domain differst from JointDemand in the sense that pure absence
is taken away, i.e., we deal *only* with non-absent demands.

Note [Strict demands]
~~~~~~~~~~~~~~~~~~~~~
isStrictDmd returns true only of demands that are
   both strict
   and  used
In particular, it is False for &lt;HyperStr, Abs&gt;, which can and does
arise in, say (#7319)
   f x = raise# &lt;some exception&gt;
Then 'x' is not used, so f gets strictness &lt;HyperStr,Abs&gt; -&gt; .
Now the w/w generates
   fx = let x &lt;HyperStr,Abs&gt; = absentError &quot;unused&quot;
        in raise &lt;some exception&gt;
At this point we really don't want to convert to
   fx = case absentError &quot;unused&quot; of x -&gt; raise &lt;some exception&gt;
Since the program is going to diverge, this swaps one error for another,
but it's really a bad idea to *ever* evaluate an absent argument.
In #7319 we get
   T7319.exe: Oops!  Entered absent arg w_s1Hd{v} [lid] [base:GHC.Base.String{tc 36u}]

Note [Dealing with call demands]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Call demands are constructed and deconstructed coherently for
strictness and absence. For instance, the strictness signature for the
following function

f :: (Int -&gt; (Int, Int)) -&gt; (Int, Bool)
f g = (snd (g 3), True)

should be: &lt;L,C(U(AU))&gt;m
-}</span><span>
</span><span id="line-658"></span><span>
</span><span id="line-659"></span><span class="hs-keyword">type</span><span> </span><span id="CleanDemand"><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-var">CleanDemand</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span>
</span><span id="line-660"></span><span>     </span><span class="hs-comment">-- A demand that is at least head-strict</span><span>
</span><span id="line-661"></span><span>
</span><span id="line-662"></span><span class="annot"><a href="GHC.Types.Demand.html#bothCleanDmd"><span class="hs-identifier hs-type">bothCleanDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span>
</span><span id="line-663"></span><span id="bothCleanDmd"><span class="annot"><span class="annottext">bothCleanDmd :: CleanDemand -&gt; CleanDemand -&gt; CleanDemand
</span><a href="GHC.Types.Demand.html#bothCleanDmd"><span class="hs-identifier hs-var hs-var">bothCleanDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810333"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810333"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810332"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810332"><span class="hs-identifier hs-var">a1</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810331"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810331"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810330"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810330"><span class="hs-identifier hs-var">a2</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-664"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: StrDmd
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810333"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#bothStr"><span class="hs-operator hs-var">`bothStr`</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810331"><span class="hs-identifier hs-var">s2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: UseDmd
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810332"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#bothUse"><span class="hs-operator hs-var">`bothUse`</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810330"><span class="hs-identifier hs-var">a2</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-665"></span><span>
</span><span id="line-666"></span><span class="annot"><a href="GHC.Types.Demand.html#mkHeadStrict"><span class="hs-identifier hs-type">mkHeadStrict</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span>
</span><span id="line-667"></span><span id="mkHeadStrict"><span class="annot"><span class="annottext">mkHeadStrict :: CleanDemand -&gt; CleanDemand
</span><a href="GHC.Types.Demand.html#mkHeadStrict"><span class="hs-identifier hs-var hs-var">mkHeadStrict</span></a></span></span><span> </span><span id="local-6989586621680810329"><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621680810329"><span class="hs-identifier hs-var">cd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621680810329"><span class="hs-identifier hs-var">cd</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: StrDmd
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-668"></span><span>
</span><span id="line-669"></span><span class="annot"><a href="GHC.Types.Demand.html#mkOnceUsedDmd"><span class="hs-identifier hs-type">mkOnceUsedDmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#mkManyUsedDmd"><span class="hs-identifier hs-type">mkManyUsedDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-670"></span><span id="mkOnceUsedDmd"><span class="annot"><span class="annottext">mkOnceUsedDmd :: CleanDemand -&gt; Demand
</span><a href="GHC.Types.Demand.html#mkOnceUsedDmd"><span class="hs-identifier hs-var hs-var">mkOnceUsedDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810328"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810328"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810327"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810327"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810328"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810327"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-671"></span><span id="mkManyUsedDmd"><span class="annot"><span class="annottext">mkManyUsedDmd :: CleanDemand -&gt; Demand
</span><a href="GHC.Types.Demand.html#mkManyUsedDmd"><span class="hs-identifier hs-var hs-var">mkManyUsedDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810326"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810326"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810325"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810325"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810326"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810325"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-672"></span><span>
</span><span id="line-673"></span><span class="annot"><a href="GHC.Types.Demand.html#evalDmd"><span class="hs-identifier hs-type">evalDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-674"></span><span class="hs-comment">-- Evaluated strictly, and used arbitrarily deeply</span><span>
</span><span id="line-675"></span><span id="evalDmd"><span class="annot"><span class="annottext">evalDmd :: Demand
</span><a href="GHC.Types.Demand.html#evalDmd"><span class="hs-identifier hs-var hs-var">evalDmd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#useTop"><span class="hs-identifier hs-var">useTop</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-676"></span><span>
</span><span id="line-677"></span><span class="annot"><a href="GHC.Types.Demand.html#mkProdDmd"><span class="hs-identifier hs-type">mkProdDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span>
</span><span id="line-678"></span><span id="mkProdDmd"><span class="annot"><span class="annottext">mkProdDmd :: [Demand] -&gt; CleanDemand
</span><a href="GHC.Types.Demand.html#mkProdDmd"><span class="hs-identifier hs-var hs-var">mkProdDmd</span></a></span></span><span> </span><span id="local-6989586621680810324"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810324"><span class="hs-identifier hs-var">dx</span></a></span></span><span>
</span><span id="line-679"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: StrDmd
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#mkSProd"><span class="hs-identifier hs-var">mkSProd</span></a></span><span> </span><span class="annot"><span class="annottext">([ArgStr] -&gt; StrDmd) -&gt; [ArgStr] -&gt; StrDmd
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Demand -&gt; ArgStr) -&gt; [Demand] -&gt; [ArgStr]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; ArgStr
forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#getStrDmd"><span class="hs-identifier hs-var">getStrDmd</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810324"><span class="hs-identifier hs-var">dx</span></a></span><span>
</span><span id="line-680"></span><span>       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: UseDmd
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#mkUProd"><span class="hs-identifier hs-var">mkUProd</span></a></span><span> </span><span class="annot"><span class="annottext">([ArgUse] -&gt; UseDmd) -&gt; [ArgUse] -&gt; UseDmd
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Demand -&gt; ArgUse) -&gt; [Demand] -&gt; [ArgUse]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; ArgUse
forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#getUseDmd"><span class="hs-identifier hs-var">getUseDmd</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810324"><span class="hs-identifier hs-var">dx</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-681"></span><span>
</span><span id="line-682"></span><span class="hs-comment">-- | Wraps the 'CleanDemand' with a one-shot call demand: @d@ -&gt; @C1(d)@.</span><span>
</span><span id="line-683"></span><span class="annot"><a href="GHC.Types.Demand.html#mkCallDmd"><span class="hs-identifier hs-type">mkCallDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span>
</span><span id="line-684"></span><span id="mkCallDmd"><span class="annot"><span class="annottext">mkCallDmd :: CleanDemand -&gt; CleanDemand
</span><a href="GHC.Types.Demand.html#mkCallDmd"><span class="hs-identifier hs-var hs-var">mkCallDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810323"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810323"><span class="hs-identifier hs-var">d</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810322"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810322"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-685"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: StrDmd
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#mkSCall"><span class="hs-identifier hs-var">mkSCall</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810323"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: UseDmd
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#mkUCall"><span class="hs-identifier hs-var">mkUCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810322"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-686"></span><span>
</span><span id="line-687"></span><span class="hs-comment">-- | @mkCallDmds n d@ returns @C1(C1...(C1 d))@ where there are @n@ @C1@'s.</span><span>
</span><span id="line-688"></span><span class="annot"><a href="GHC.Types.Demand.html#mkCallDmds"><span class="hs-identifier hs-type">mkCallDmds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span>
</span><span id="line-689"></span><span id="mkCallDmds"><span class="annot"><span class="annottext">mkCallDmds :: Int -&gt; CleanDemand -&gt; CleanDemand
</span><a href="GHC.Types.Demand.html#mkCallDmds"><span class="hs-identifier hs-var hs-var">mkCallDmds</span></a></span></span><span> </span><span id="local-6989586621680810320"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810320"><span class="hs-identifier hs-var">arity</span></a></span></span><span> </span><span id="local-6989586621680810319"><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621680810319"><span class="hs-identifier hs-var">cd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CleanDemand -&gt; CleanDemand) -&gt; CleanDemand -&gt; [CleanDemand]
forall a. (a -&gt; a) -&gt; a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#iterate"><span class="hs-identifier hs-var">iterate</span></a></span><span> </span><span class="annot"><span class="annottext">CleanDemand -&gt; CleanDemand
</span><a href="GHC.Types.Demand.html#mkCallDmd"><span class="hs-identifier hs-var">mkCallDmd</span></a></span><span> </span><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621680810319"><span class="hs-identifier hs-var">cd</span></a></span><span> </span><span class="annot"><span class="annottext">[CleanDemand] -&gt; Int -&gt; CleanDemand
forall a. [a] -&gt; Int -&gt; a
</span><a href="../../base/src/GHC.List.html#%21%21"><span class="hs-operator hs-var">!!</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810320"><span class="hs-identifier hs-var">arity</span></a></span><span>
</span><span id="line-690"></span><span>
</span><span id="line-691"></span><span class="hs-comment">-- See Note [Demand on the worker] in GHC.Core.Opt.WorkWrap</span><span>
</span><span id="line-692"></span><span class="annot"><a href="GHC.Types.Demand.html#mkWorkerDemand"><span class="hs-identifier hs-type">mkWorkerDemand</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-693"></span><span id="mkWorkerDemand"><span class="annot"><span class="annottext">mkWorkerDemand :: Int -&gt; Demand
</span><a href="GHC.Types.Demand.html#mkWorkerDemand"><span class="hs-identifier hs-var hs-var">mkWorkerDemand</span></a></span></span><span> </span><span id="local-6989586621680810316"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810316"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; UseDmd
forall {t}. (Eq t, Num t) =&gt; t -&gt; UseDmd
</span><a href="#local-6989586621680810315"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810316"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-694"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680810315"><span class="annot"><span class="annottext">go :: t -&gt; UseDmd
</span><a href="#local-6989586621680810315"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>
</span><span id="line-695"></span><span>        </span><span class="annot"><a href="#local-6989586621680810315"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680810308"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680810308"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#mkUCall"><span class="hs-identifier hs-var">mkUCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">(UseDmd -&gt; UseDmd) -&gt; UseDmd -&gt; UseDmd
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">t -&gt; UseDmd
</span><a href="#local-6989586621680810315"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680810308"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">t
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-696"></span><span>
</span><span id="line-697"></span><span class="annot"><a href="GHC.Types.Demand.html#cleanEvalDmd"><span class="hs-identifier hs-type">cleanEvalDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span>
</span><span id="line-698"></span><span id="cleanEvalDmd"><span class="annot"><span class="annottext">cleanEvalDmd :: CleanDemand
</span><a href="GHC.Types.Demand.html#cleanEvalDmd"><span class="hs-identifier hs-var hs-var">cleanEvalDmd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: StrDmd
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: UseDmd
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-699"></span><span>
</span><span id="line-700"></span><span class="annot"><a href="GHC.Types.Demand.html#cleanEvalProdDmd"><span class="hs-identifier hs-type">cleanEvalProdDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span>
</span><span id="line-701"></span><span id="cleanEvalProdDmd"><span class="annot"><span class="annottext">cleanEvalProdDmd :: Int -&gt; CleanDemand
</span><a href="GHC.Types.Demand.html#cleanEvalProdDmd"><span class="hs-identifier hs-var hs-var">cleanEvalProdDmd</span></a></span></span><span> </span><span id="local-6989586621680810307"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810307"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: StrDmd
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: UseDmd
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ArgUse -&gt; [ArgUse]
forall a. Int -&gt; a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#replicate"><span class="hs-identifier hs-var">replicate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810307"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#useTop"><span class="hs-identifier hs-var">useTop</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-702"></span><span>
</span><span id="line-703"></span><span>
</span><span id="line-704"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
           Demand: Combining Strictness and Usage
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-711"></span><span>
</span><span id="line-712"></span><span class="hs-keyword">type</span><span> </span><span id="Demand"><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-var">Demand</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span>
</span><span id="line-713"></span><span>
</span><span id="line-714"></span><span class="annot"><a href="GHC.Types.Demand.html#lubDmd"><span class="hs-identifier hs-type">lubDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-715"></span><span id="lubDmd"><span class="annot"><span class="annottext">lubDmd :: Demand -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#lubDmd"><span class="hs-identifier hs-var hs-var">lubDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810306"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810306"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810305"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810305"><span class="hs-identifier hs-var">a1</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810304"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810304"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810303"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810303"><span class="hs-identifier hs-var">a2</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-716"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810306"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; ArgStr -&gt; ArgStr
</span><a href="GHC.Types.Demand.html#lubArgStr"><span class="hs-operator hs-var">`lubArgStr`</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810304"><span class="hs-identifier hs-var">s2</span></a></span><span>
</span><span id="line-717"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810305"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#lubArgUse"><span class="hs-operator hs-var">`lubArgUse`</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810303"><span class="hs-identifier hs-var">a2</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-718"></span><span>
</span><span id="line-719"></span><span class="annot"><a href="GHC.Types.Demand.html#bothDmd"><span class="hs-identifier hs-type">bothDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-720"></span><span id="bothDmd"><span class="annot"><span class="annottext">bothDmd :: Demand -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#bothDmd"><span class="hs-identifier hs-var hs-var">bothDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810302"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810302"><span class="hs-identifier hs-var">s1</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810301"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810301"><span class="hs-identifier hs-var">a1</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810300"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810300"><span class="hs-identifier hs-var">s2</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810299"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810299"><span class="hs-identifier hs-var">a2</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-721"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810302"><span class="hs-identifier hs-var">s1</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; ArgStr -&gt; ArgStr
</span><a href="GHC.Types.Demand.html#bothArgStr"><span class="hs-operator hs-var">`bothArgStr`</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810300"><span class="hs-identifier hs-var">s2</span></a></span><span>
</span><span id="line-722"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810301"><span class="hs-identifier hs-var">a1</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#bothArgUse"><span class="hs-operator hs-var">`bothArgUse`</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810299"><span class="hs-identifier hs-var">a2</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-723"></span><span>
</span><span id="line-724"></span><span class="annot"><a href="GHC.Types.Demand.html#lazyApply1Dmd"><span class="hs-identifier hs-type">lazyApply1Dmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#lazyApply2Dmd"><span class="hs-identifier hs-type">lazyApply2Dmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#strictApply1Dmd"><span class="hs-identifier hs-type">strictApply1Dmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-725"></span><span>
</span><span id="line-726"></span><span id="strictApply1Dmd"><span class="annot"><span class="annottext">strictApply1Dmd :: Demand
</span><a href="GHC.Types.Demand.html#strictApply1Dmd"><span class="hs-identifier hs-var hs-var">strictApply1Dmd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-var">SCall</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-727"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-728"></span><span>
</span><span id="line-729"></span><span id="lazyApply1Dmd"><span class="annot"><span class="annottext">lazyApply1Dmd :: Demand
</span><a href="GHC.Types.Demand.html#lazyApply1Dmd"><span class="hs-identifier hs-var hs-var">lazyApply1Dmd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>
</span><span id="line-730"></span><span>                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-731"></span><span>
</span><span id="line-732"></span><span class="hs-comment">-- Second argument of catch#:</span><span>
</span><span id="line-733"></span><span class="hs-comment">--    uses its arg at most once, applies it once</span><span>
</span><span id="line-734"></span><span class="hs-comment">--    but is lazy (might not be called at all)</span><span>
</span><span id="line-735"></span><span id="lazyApply2Dmd"><span class="annot"><span class="annottext">lazyApply2Dmd :: Demand
</span><a href="GHC.Types.Demand.html#lazyApply2Dmd"><span class="hs-identifier hs-var hs-var">lazyApply2Dmd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>
</span><span id="line-736"></span><span>                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-737"></span><span>
</span><span id="line-738"></span><span class="annot"><a href="GHC.Types.Demand.html#absDmd"><span class="hs-identifier hs-type">absDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-739"></span><span id="absDmd"><span class="annot"><span class="annottext">absDmd :: Demand
</span><a href="GHC.Types.Demand.html#absDmd"><span class="hs-identifier hs-var hs-var">absDmd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
forall u. Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-740"></span><span>
</span><span id="line-741"></span><span class="annot"><a href="GHC.Types.Demand.html#topDmd"><span class="hs-identifier hs-type">topDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-742"></span><span id="topDmd"><span class="annot"><span class="annottext">topDmd :: Demand
</span><a href="GHC.Types.Demand.html#topDmd"><span class="hs-identifier hs-var hs-var">topDmd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#useTop"><span class="hs-identifier hs-var">useTop</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-743"></span><span>
</span><span id="line-744"></span><span class="annot"><a href="GHC.Types.Demand.html#botDmd"><span class="hs-identifier hs-type">botDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-745"></span><span id="botDmd"><span class="annot"><span class="annottext">botDmd :: Demand
</span><a href="GHC.Types.Demand.html#botDmd"><span class="hs-identifier hs-var hs-var">botDmd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#strBot"><span class="hs-identifier hs-var">strBot</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#useBot"><span class="hs-identifier hs-var">useBot</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-746"></span><span>
</span><span id="line-747"></span><span class="annot"><a href="GHC.Types.Demand.html#seqDmd"><span class="hs-identifier hs-type">seqDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-748"></span><span id="seqDmd"><span class="annot"><span class="annottext">seqDmd :: Demand
</span><a href="GHC.Types.Demand.html#seqDmd"><span class="hs-identifier hs-var hs-var">seqDmd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-749"></span><span>
</span><span id="line-750"></span><span id="local-6989586621680810979"><span id="local-6989586621680810980"><span class="annot"><a href="GHC.Types.Demand.html#oneifyDmd"><span class="hs-identifier hs-type">oneifyDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810980"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810979"><span class="hs-identifier hs-type">u</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810980"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810979"><span class="hs-identifier hs-type">u</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-751"></span><span id="oneifyDmd"><span class="annot"><span class="annottext">oneifyDmd :: forall s u. JointDmd s (Use u) -&gt; JointDmd s (Use u)
</span><a href="GHC.Types.Demand.html#oneifyDmd"><span class="hs-identifier hs-var hs-var">oneifyDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810298"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621680810298"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810297"><span class="annot"><span class="annottext">u
</span><a href="#local-6989586621680810297"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621680810298"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: Use u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; u -&gt; Use u
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">u
</span><a href="#local-6989586621680810297"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-752"></span><span class="annot"><a href="GHC.Types.Demand.html#oneifyDmd"><span class="hs-identifier hs-var">oneifyDmd</span></a></span><span> </span><span id="local-6989586621680810296"><span class="annot"><span class="annottext">JointDmd s (Use u)
</span><a href="#local-6989586621680810296"><span class="hs-identifier hs-var">jd</span></a></span></span><span>                            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JointDmd s (Use u)
</span><a href="#local-6989586621680810296"><span class="hs-identifier hs-var">jd</span></a></span><span>
</span><span id="line-753"></span><span>
</span><span id="line-754"></span><span class="annot"><a href="GHC.Types.Demand.html#isTopDmd"><span class="hs-identifier hs-type">isTopDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-755"></span><span class="hs-comment">-- Used to suppress pretty-printing of an uninformative demand</span><span>
</span><span id="line-756"></span><span id="isTopDmd"><span class="annot"><span class="annottext">isTopDmd :: Demand -&gt; Bool
</span><a href="GHC.Types.Demand.html#isTopDmd"><span class="hs-identifier hs-var hs-var">isTopDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-757"></span><span class="annot"><a href="GHC.Types.Demand.html#isTopDmd"><span class="hs-identifier hs-var">isTopDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Demand
</span><span class="hs-identifier">_</span></span><span>                                    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-758"></span><span>
</span><span id="line-759"></span><span id="local-6989586621680810975"><span id="local-6989586621680810976"><span class="annot"><a href="GHC.Types.Demand.html#isAbsDmd"><span class="hs-identifier hs-type">isAbsDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810976"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810975"><span class="hs-identifier hs-type">u</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span></span><span>
</span><span id="line-760"></span><span id="isAbsDmd"><span class="annot"><span class="annottext">isAbsDmd :: forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isAbsDmd"><span class="hs-identifier hs-var hs-var">isAbsDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>   </span><span class="hs-comment">-- The strictness part can be HyperStr</span><span>
</span><span id="line-761"></span><span class="annot"><a href="GHC.Types.Demand.html#isAbsDmd"><span class="hs-identifier hs-var">isAbsDmd</span></a></span><span> </span><span class="annot"><span class="annottext">JointDmd (Str s) (Use u)
</span><span class="hs-identifier">_</span></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>  </span><span class="hs-comment">-- for a bottom demand</span><span>
</span><span id="line-762"></span><span>
</span><span id="line-763"></span><span class="annot"><a href="GHC.Types.Demand.html#isSeqDmd"><span class="hs-identifier hs-type">isSeqDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-764"></span><span id="isSeqDmd"><span class="annot"><span class="annottext">isSeqDmd :: Demand -&gt; Bool
</span><a href="GHC.Types.Demand.html#isSeqDmd"><span class="hs-identifier hs-var hs-var">isSeqDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-765"></span><span class="annot"><a href="GHC.Types.Demand.html#isSeqDmd"><span class="hs-identifier hs-var">isSeqDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Demand
</span><span class="hs-identifier">_</span></span><span>                                                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-766"></span><span>
</span><span id="line-767"></span><span id="local-6989586621680810294"><span id="local-6989586621680810295"><span class="annot"><a href="GHC.Types.Demand.html#isUsedOnce"><span class="hs-identifier hs-type">isUsedOnce</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810295"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810294"><span class="hs-identifier hs-type">u</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span></span><span>
</span><span id="line-768"></span><span id="isUsedOnce"><span class="annot"><span class="annottext">isUsedOnce :: forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isUsedOnce"><span class="hs-identifier hs-var hs-var">isUsedOnce</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810293"><span class="annot"><span class="annottext">Use u
</span><a href="#local-6989586621680810293"><span class="hs-identifier hs-var">a</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Use u -&gt; Count
forall u. Use u -&gt; Count
</span><a href="GHC.Types.Demand.html#useCount"><span class="hs-identifier hs-var">useCount</span></a></span><span> </span><span class="annot"><span class="annottext">Use u
</span><a href="#local-6989586621680810293"><span class="hs-identifier hs-var">a</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-769"></span><span>                               </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-770"></span><span>                               </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-771"></span><span>
</span><span id="line-772"></span><span class="hs-comment">-- More utility functions for strictness</span><span>
</span><span id="line-773"></span><span class="annot"><a href="GHC.Types.Demand.html#seqDemand"><span class="hs-identifier hs-type">seqDemand</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-774"></span><span id="seqDemand"><span class="annot"><span class="annottext">seqDemand :: Demand -&gt; ()
</span><a href="GHC.Types.Demand.html#seqDemand"><span class="hs-identifier hs-var hs-var">seqDemand</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810292"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810292"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810291"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810291"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; ()
</span><a href="GHC.Types.Demand.html#seqArgStr"><span class="hs-identifier hs-var">seqArgStr</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810292"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; ()
</span><a href="GHC.Types.Demand.html#seqArgUse"><span class="hs-identifier hs-var">seqArgUse</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810291"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-775"></span><span>
</span><span id="line-776"></span><span class="annot"><a href="GHC.Types.Demand.html#seqDemandList"><span class="hs-identifier hs-type">seqDemandList</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-777"></span><span id="seqDemandList"><span class="annot"><span class="annottext">seqDemandList :: [Demand] -&gt; ()
</span><a href="GHC.Types.Demand.html#seqDemandList"><span class="hs-identifier hs-var hs-var">seqDemandList</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-778"></span><span class="annot"><a href="GHC.Types.Demand.html#seqDemandList"><span class="hs-identifier hs-var">seqDemandList</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680810290"><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680810290"><span class="hs-identifier hs-var">d</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680810289"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810289"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand -&gt; ()
</span><a href="GHC.Types.Demand.html#seqDemand"><span class="hs-identifier hs-var">seqDemand</span></a></span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680810290"><span class="hs-identifier hs-var">d</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; ()
</span><a href="GHC.Types.Demand.html#seqDemandList"><span class="hs-identifier hs-var">seqDemandList</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810289"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-779"></span><span>
</span><span id="line-780"></span><span id="local-6989586621680810287"><span id="local-6989586621680810288"><span class="annot"><a href="GHC.Types.Demand.html#isStrictDmd"><span class="hs-identifier hs-type">isStrictDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810288"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810287"><span class="hs-identifier hs-type">u</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span></span></span><span>
</span><span id="line-781"></span><span class="hs-comment">-- See Note [Strict demands]</span><span>
</span><span id="line-782"></span><span id="isStrictDmd"><span class="annot"><span class="annottext">isStrictDmd :: forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isStrictDmd"><span class="hs-identifier hs-var hs-var">isStrictDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span class="hs-special">}</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-783"></span><span class="annot"><a href="GHC.Types.Demand.html#isStrictDmd"><span class="hs-identifier hs-var">isStrictDmd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-784"></span><span class="annot"><a href="GHC.Types.Demand.html#isStrictDmd"><span class="hs-identifier hs-var">isStrictDmd</span></a></span><span> </span><span class="annot"><span class="annottext">JointDmd (Str s) (Use u)
</span><span class="hs-identifier">_</span></span><span>                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-785"></span><span>
</span><span id="line-786"></span><span class="annot"><a href="GHC.Types.Demand.html#isWeakDmd"><span class="hs-identifier hs-type">isWeakDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-787"></span><span id="isWeakDmd"><span class="annot"><span class="annottext">isWeakDmd :: Demand -&gt; Bool
</span><a href="GHC.Types.Demand.html#isWeakDmd"><span class="hs-identifier hs-var hs-var">isWeakDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810285"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810285"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810284"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810284"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; Bool
</span><a href="GHC.Types.Demand.html#isLazy"><span class="hs-identifier hs-var">isLazy</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810285"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; Bool
</span><a href="GHC.Types.Demand.html#isUsedMU"><span class="hs-identifier hs-var">isUsedMU</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810284"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-788"></span><span>
</span><span id="line-789"></span><span class="annot"><a href="GHC.Types.Demand.html#cleanUseDmd_maybe"><span class="hs-identifier hs-type">cleanUseDmd_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span>
</span><span id="line-790"></span><span id="cleanUseDmd_maybe"><span class="annot"><span class="annottext">cleanUseDmd_maybe :: Demand -&gt; Maybe UseDmd
</span><a href="GHC.Types.Demand.html#cleanUseDmd_maybe"><span class="hs-identifier hs-var hs-var">cleanUseDmd_maybe</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810282"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810282"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; Maybe UseDmd
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810282"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-791"></span><span class="annot"><a href="GHC.Types.Demand.html#cleanUseDmd_maybe"><span class="hs-identifier hs-var">cleanUseDmd_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Demand
</span><span class="hs-identifier">_</span></span><span>                     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe UseDmd
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-792"></span><span>
</span><span id="line-793"></span><span class="annot"><a href="GHC.Types.Demand.html#splitFVs"><span class="hs-identifier hs-type">splitFVs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>   </span><span class="hs-comment">-- Thunk</span><span>
</span><span id="line-794"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-795"></span><span id="splitFVs"><span class="annot"><span class="annottext">splitFVs :: Bool -&gt; DmdEnv -&gt; (DmdEnv, DmdEnv)
</span><a href="GHC.Types.Demand.html#splitFVs"><span class="hs-identifier hs-var hs-var">splitFVs</span></a></span></span><span> </span><span id="local-6989586621680810281"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680810281"><span class="hs-identifier hs-var">is_thunk</span></a></span></span><span> </span><span id="local-6989586621680810280"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810280"><span class="hs-identifier hs-var">rhs_fvs</span></a></span></span><span>
</span><span id="line-796"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680810281"><span class="hs-identifier hs-var">is_thunk</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictPair DmdEnv DmdEnv -&gt; (DmdEnv, DmdEnv)
forall a b. StrictPair a b -&gt; (a, b)
</span><a href="GHC.Types.Demand.html#strictPairToTuple"><span class="hs-identifier hs-var">strictPairToTuple</span></a></span><span> </span><span class="annot"><span class="annottext">(StrictPair DmdEnv DmdEnv -&gt; (DmdEnv, DmdEnv))
-&gt; StrictPair DmdEnv DmdEnv -&gt; (DmdEnv, DmdEnv)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-797"></span><span>                </span><span class="annot"><span class="annottext">(Unique
 -&gt; Demand -&gt; StrictPair DmdEnv DmdEnv -&gt; StrictPair DmdEnv DmdEnv)
-&gt; StrictPair DmdEnv DmdEnv -&gt; DmdEnv -&gt; StrictPair DmdEnv DmdEnv
forall elt a key.
(Unique -&gt; elt -&gt; a -&gt; a) -&gt; a -&gt; UniqFM key elt -&gt; a
</span><a href="GHC.Types.Unique.FM.html#nonDetStrictFoldUFM_Directly"><span class="hs-identifier hs-var">nonDetStrictFoldUFM_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
-&gt; Demand -&gt; StrictPair DmdEnv DmdEnv -&gt; StrictPair DmdEnv DmdEnv
forall {s} {u} {key} {key} {u}.
Unique
-&gt; JointDmd (Str s) u
-&gt; StrictPair
     (UniqFM key (JointDmd (Str s) u))
     (UniqFM key (JointDmd (Str s) (Use u)))
-&gt; StrictPair
     (UniqFM key (JointDmd (Str s) u))
     (UniqFM key (JointDmd (Str s) (Use u)))
</span><a href="#local-6989586621680810277"><span class="hs-identifier hs-var">add</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdEnv
forall a. VarEnv a
</span><a href="GHC.Types.Var.Env.html#emptyVarEnv"><span class="hs-identifier hs-var">emptyVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; DmdEnv -&gt; StrictPair DmdEnv DmdEnv
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="GHC.Types.Demand.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
forall a. VarEnv a
</span><a href="GHC.Types.Var.Env.html#emptyVarEnv"><span class="hs-identifier hs-var">emptyVarEnv</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810280"><span class="hs-identifier hs-var">rhs_fvs</span></a></span><span>
</span><span id="line-798"></span><span>                </span><span class="hs-comment">-- It's OK to use a non-deterministic fold because we</span><span>
</span><span id="line-799"></span><span>                </span><span class="hs-comment">-- immediately forget the ordering by putting the elements</span><span>
</span><span id="line-800"></span><span>                </span><span class="hs-comment">-- in the envs again</span><span>
</span><span id="line-801"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Demand -&gt; Bool) -&gt; DmdEnv -&gt; (DmdEnv, DmdEnv)
forall a. (a -&gt; Bool) -&gt; VarEnv a -&gt; (VarEnv a, VarEnv a)
</span><a href="GHC.Types.Var.Env.html#partitionVarEnv"><span class="hs-identifier hs-var">partitionVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Bool
</span><a href="GHC.Types.Demand.html#isWeakDmd"><span class="hs-identifier hs-var">isWeakDmd</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810280"><span class="hs-identifier hs-var">rhs_fvs</span></a></span><span>
</span><span id="line-802"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-803"></span><span>    </span><span id="local-6989586621680810277"><span class="annot"><span class="annottext">add :: Unique
-&gt; JointDmd (Str s) u
-&gt; StrictPair
     (UniqFM key (JointDmd (Str s) u))
     (UniqFM key (JointDmd (Str s) (Use u)))
-&gt; StrictPair
     (UniqFM key (JointDmd (Str s) u))
     (UniqFM key (JointDmd (Str s) (Use u)))
</span><a href="#local-6989586621680810277"><span class="hs-identifier hs-var hs-var">add</span></a></span></span><span> </span><span id="local-6989586621680810273"><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621680810273"><span class="hs-identifier hs-var">uniq</span></a></span></span><span> </span><span id="local-6989586621680810272"><span class="annot"><span class="annottext">dmd :: JointDmd (Str s) u
</span><a href="#local-6989586621680810272"><span class="hs-identifier hs-var">dmd</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810271"><span class="annot"><span class="annottext">Str s
</span><a href="#local-6989586621680810271"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810270"><span class="annot"><span class="annottext">u
</span><a href="#local-6989586621680810270"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680810269"><span class="annot"><span class="annottext">UniqFM key (JointDmd (Str s) u)
</span><a href="#local-6989586621680810269"><span class="hs-identifier hs-var">lazy_fv</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621680810268"><span class="annot"><span class="annottext">UniqFM key (JointDmd (Str s) (Use u))
</span><a href="#local-6989586621680810268"><span class="hs-identifier hs-var">sig_fv</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-804"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Str s
</span><a href="#local-6989586621680810271"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM key (JointDmd (Str s) u)
-&gt; Unique -&gt; JointDmd (Str s) u -&gt; UniqFM key (JointDmd (Str s) u)
forall key elt. UniqFM key elt -&gt; Unique -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM_Directly"><span class="hs-identifier hs-var">addToUFM_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM key (JointDmd (Str s) u)
</span><a href="#local-6989586621680810269"><span class="hs-identifier hs-var">lazy_fv</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621680810273"><span class="hs-identifier hs-var">uniq</span></a></span><span> </span><span class="annot"><span class="annottext">JointDmd (Str s) u
</span><a href="#local-6989586621680810272"><span class="hs-identifier hs-var">dmd</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM key (JointDmd (Str s) u)
-&gt; UniqFM key (JointDmd (Str s) (Use u))
-&gt; StrictPair
     (UniqFM key (JointDmd (Str s) u))
     (UniqFM key (JointDmd (Str s) (Use u)))
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="GHC.Types.Demand.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM key (JointDmd (Str s) (Use u))
</span><a href="#local-6989586621680810268"><span class="hs-identifier hs-var">sig_fv</span></a></span><span>
</span><span id="line-805"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqFM key (JointDmd (Str s) u)
-&gt; Unique -&gt; JointDmd (Str s) u -&gt; UniqFM key (JointDmd (Str s) u)
forall key elt. UniqFM key elt -&gt; Unique -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM_Directly"><span class="hs-identifier hs-var">addToUFM_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM key (JointDmd (Str s) u)
</span><a href="#local-6989586621680810269"><span class="hs-identifier hs-var">lazy_fv</span></a></span><span> </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621680810273"><span class="hs-identifier hs-var">uniq</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: Str s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Str s
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">u
</span><a href="#local-6989586621680810270"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-806"></span><span>                    </span><span class="annot"><span class="annottext">UniqFM key (JointDmd (Str s) u)
-&gt; UniqFM key (JointDmd (Str s) (Use u))
-&gt; StrictPair
     (UniqFM key (JointDmd (Str s) u))
     (UniqFM key (JointDmd (Str s) (Use u)))
forall a b. a -&gt; b -&gt; StrictPair a b
</span><a href="GHC.Types.Demand.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span><span>
</span><span id="line-807"></span><span>                    </span><span class="annot"><span class="annottext">UniqFM key (JointDmd (Str s) (Use u))
-&gt; Unique
-&gt; JointDmd (Str s) (Use u)
-&gt; UniqFM key (JointDmd (Str s) (Use u))
forall key elt. UniqFM key elt -&gt; Unique -&gt; elt -&gt; UniqFM key elt
</span><a href="GHC.Types.Unique.FM.html#addToUFM_Directly"><span class="hs-identifier hs-var">addToUFM_Directly</span></a></span><span> </span><span class="annot"><span class="annottext">UniqFM key (JointDmd (Str s) (Use u))
</span><a href="#local-6989586621680810268"><span class="hs-identifier hs-var">sig_fv</span></a></span><span>  </span><span class="annot"><span class="annottext">Unique
</span><a href="#local-6989586621680810273"><span class="hs-identifier hs-var">uniq</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: Str s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Str s
</span><a href="#local-6989586621680810271"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span>    </span><span class="annot"><span class="annottext">ud :: Use u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Use u
forall u. Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-808"></span><span>
</span><span id="line-809"></span><span class="annot"><a href="GHC.Types.Demand.html#keepAliveDmdEnv"><span class="hs-identifier hs-type">keepAliveDmdEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#IdSet"><span class="hs-identifier hs-type">IdSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span>
</span><span id="line-810"></span><span class="hs-comment">-- (keepAliveDmdType dt vs) makes sure that the Ids in vs have</span><span>
</span><span id="line-811"></span><span class="hs-comment">-- /some/ usage in the returned demand types -- they are not Absent</span><span>
</span><span id="line-812"></span><span class="hs-comment">-- See Note [Absence analysis for stable unfoldings and RULES]</span><span>
</span><span id="line-813"></span><span class="hs-comment">--     in GHC.Core.Opt.DmdAnal</span><span>
</span><span id="line-814"></span><span id="keepAliveDmdEnv"><span class="annot"><span class="annottext">keepAliveDmdEnv :: DmdEnv -&gt; IdSet -&gt; DmdEnv
</span><a href="GHC.Types.Demand.html#keepAliveDmdEnv"><span class="hs-identifier hs-var hs-var">keepAliveDmdEnv</span></a></span></span><span> </span><span id="local-6989586621680810266"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810266"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680810265"><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621680810265"><span class="hs-identifier hs-var">vs</span></a></span></span><span>
</span><span id="line-815"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Var -&gt; DmdEnv -&gt; DmdEnv) -&gt; DmdEnv -&gt; IdSet -&gt; DmdEnv
forall a. (Var -&gt; a -&gt; a) -&gt; a -&gt; IdSet -&gt; a
</span><a href="GHC.Types.Var.Set.html#nonDetStrictFoldVarSet"><span class="hs-identifier hs-var">nonDetStrictFoldVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">Var -&gt; DmdEnv -&gt; DmdEnv
</span><a href="#local-6989586621680810263"><span class="hs-identifier hs-var">add</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810266"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">IdSet
</span><a href="#local-6989586621680810265"><span class="hs-identifier hs-var">vs</span></a></span><span>
</span><span id="line-816"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-817"></span><span>    </span><span class="annot"><a href="#local-6989586621680810263"><span class="hs-identifier hs-type">add</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span>
</span><span id="line-818"></span><span>    </span><span id="local-6989586621680810263"><span class="annot"><span class="annottext">add :: Var -&gt; DmdEnv -&gt; DmdEnv
</span><a href="#local-6989586621680810263"><span class="hs-identifier hs-var hs-var">add</span></a></span></span><span> </span><span id="local-6989586621680810262"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680810262"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span id="local-6989586621680810261"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810261"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Demand -&gt; Demand -&gt; Demand) -&gt; DmdEnv -&gt; Var -&gt; Demand -&gt; DmdEnv
forall a. (a -&gt; a -&gt; a) -&gt; VarEnv a -&gt; Var -&gt; a -&gt; VarEnv a
</span><a href="GHC.Types.Var.Env.html#extendVarEnv_C"><span class="hs-identifier hs-var">extendVarEnv_C</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Demand -&gt; Demand
</span><a href="#local-6989586621680810259"><span class="hs-identifier hs-var">add_dmd</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810261"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680810262"><span class="hs-identifier hs-var">v</span></a></span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="GHC.Types.Demand.html#topDmd"><span class="hs-identifier hs-var">topDmd</span></a></span><span>
</span><span id="line-819"></span><span>
</span><span id="line-820"></span><span>    </span><span class="annot"><a href="#local-6989586621680810259"><span class="hs-identifier hs-type">add_dmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-821"></span><span>    </span><span class="hs-comment">-- If the existing usage is Absent, make it used</span><span>
</span><span id="line-822"></span><span>    </span><span class="hs-comment">-- Otherwise leave it alone</span><span>
</span><span id="line-823"></span><span>    </span><span id="local-6989586621680810259"><span class="annot"><span class="annottext">add_dmd :: Demand -&gt; Demand -&gt; Demand
</span><a href="#local-6989586621680810259"><span class="hs-identifier hs-var hs-var">add_dmd</span></a></span></span><span> </span><span id="local-6989586621680810258"><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680810258"><span class="hs-identifier hs-var">dmd</span></a></span></span><span> </span><span class="annot"><span class="annottext">Demand
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Bool
forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isAbsDmd"><span class="hs-identifier hs-var">isAbsDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680810258"><span class="hs-identifier hs-var">dmd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="GHC.Types.Demand.html#topDmd"><span class="hs-identifier hs-var">topDmd</span></a></span><span>
</span><span id="line-824"></span><span>                  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680810258"><span class="hs-identifier hs-var">dmd</span></a></span><span>
</span><span id="line-825"></span><span>
</span><span id="line-826"></span><span class="annot"><a href="GHC.Types.Demand.html#splitProdDmd_maybe"><span class="hs-identifier hs-type">splitProdDmd_maybe</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-827"></span><span class="hs-comment">-- Split a product into its components, iff there is any</span><span>
</span><span id="line-828"></span><span class="hs-comment">-- useful information to be extracted thereby</span><span>
</span><span id="line-829"></span><span class="hs-comment">-- The demand is not necessarily strict!</span><span>
</span><span id="line-830"></span><span id="splitProdDmd_maybe"><span class="annot"><span class="annottext">splitProdDmd_maybe :: Demand -&gt; Maybe [Demand]
</span><a href="GHC.Types.Demand.html#splitProdDmd_maybe"><span class="hs-identifier hs-var hs-var">splitProdDmd_maybe</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810257"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810257"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810256"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810256"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-831"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810257"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810256"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-832"></span><span>      </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span id="local-6989586621680810255"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810255"><span class="hs-identifier hs-var">sx</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810254"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810254"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680810253"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810253"><span class="hs-identifier hs-var">ux</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; UseDmd -&gt; Maybe [ArgUse]
</span><a href="GHC.Types.Demand.html#splitUseProdDmd"><span class="hs-identifier hs-var">splitUseProdDmd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ArgStr] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810255"><span class="hs-identifier hs-var">sx</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810254"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-833"></span><span>                                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; Maybe [Demand]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ArgStr] -&gt; [ArgUse] -&gt; [Demand]
forall s u. [s] -&gt; [u] -&gt; [JointDmd s u]
</span><a href="GHC.Types.Demand.html#mkJointDmds"><span class="hs-identifier hs-var">mkJointDmds</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810255"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810253"><span class="hs-identifier hs-var">ux</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-834"></span><span>      </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span id="local-6989586621680810252"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810252"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810251"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810251"><span class="hs-identifier hs-var">ux</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680810250"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810250"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; StrDmd -&gt; Maybe [ArgStr]
</span><a href="GHC.Types.Demand.html#splitStrProdDmd"><span class="hs-identifier hs-var">splitStrProdDmd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ArgUse] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810251"><span class="hs-identifier hs-var">ux</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810252"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-835"></span><span>                                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; Maybe [Demand]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ArgStr] -&gt; [ArgUse] -&gt; [Demand]
forall s u. [s] -&gt; [u] -&gt; [JointDmd s u]
</span><a href="GHC.Types.Demand.html#mkJointDmds"><span class="hs-identifier hs-var">mkJointDmds</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810250"><span class="hs-identifier hs-var">sx</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810251"><span class="hs-identifier hs-var">ux</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-836"></span><span>      </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span class="hs-special">,</span><span>  </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810249"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810249"><span class="hs-identifier hs-var">ux</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; Maybe [Demand]
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ArgStr] -&gt; [ArgUse] -&gt; [Demand]
forall s u. [s] -&gt; [u] -&gt; [JointDmd s u]
</span><a href="GHC.Types.Demand.html#mkJointDmds"><span class="hs-identifier hs-var">mkJointDmds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; ArgStr -&gt; [ArgStr]
forall a. Int -&gt; a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#replicate"><span class="hs-identifier hs-var">replicate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ArgUse] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810249"><span class="hs-identifier hs-var">ux</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810249"><span class="hs-identifier hs-var">ux</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-837"></span><span>      </span><span class="annot"><span class="annottext">(ArgStr, ArgUse)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe [Demand]
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-838"></span><span>
</span><span id="line-839"></span><span class="hs-keyword">data</span><span> </span><span id="StrictPair"><span class="annot"><a href="GHC.Types.Demand.html#StrictPair"><span class="hs-identifier hs-var">StrictPair</span></a></span></span><span> </span><span id="local-6989586621680810952"><span class="annot"><a href="#local-6989586621680810952"><span class="hs-identifier hs-type">a</span></a></span></span><span> </span><span id="local-6989586621680810951"><span class="annot"><a href="#local-6989586621680810951"><span class="hs-identifier hs-type">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="#local-6989586621680810952"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span id="%3A%2A%3A"><span class="annot"><a href="GHC.Types.Demand.html#%3A%2A%3A"><span class="hs-operator hs-var">:*:</span></a></span></span><span> </span><span class="hs-glyph">!</span><span class="annot"><a href="#local-6989586621680810951"><span class="hs-identifier hs-type">b</span></a></span><span>
</span><span id="line-840"></span><span>
</span><span id="line-841"></span><span id="local-6989586621680810965"><span id="local-6989586621680810966"><span class="annot"><a href="GHC.Types.Demand.html#strictPairToTuple"><span class="hs-identifier hs-type">strictPairToTuple</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictPair"><span class="hs-identifier hs-type">StrictPair</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810966"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810965"><span class="hs-identifier hs-type">b</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621680810966"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621680810965"><span class="hs-identifier hs-type">b</span></a></span><span class="hs-special">)</span></span></span><span>
</span><span id="line-842"></span><span id="strictPairToTuple"><span class="annot"><span class="annottext">strictPairToTuple :: forall a b. StrictPair a b -&gt; (a, b)
</span><a href="GHC.Types.Demand.html#strictPairToTuple"><span class="hs-identifier hs-var hs-var">strictPairToTuple</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680810248"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680810248"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#%3A%2A%3A"><span class="hs-operator hs-type">:*:</span></a></span><span> </span><span id="local-6989586621680810247"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680810247"><span class="hs-identifier hs-var">y</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680810248"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621680810247"><span class="hs-identifier hs-var">y</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-843"></span><span>
</span><span id="line-844"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
               TypeShape and demand trimming
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-849"></span><span>
</span><span id="line-850"></span><span>
</span><span id="line-851"></span><span class="hs-keyword">data</span><span> </span><span id="TypeShape"><span class="annot"><a href="GHC.Types.Demand.html#TypeShape"><span class="hs-identifier hs-var">TypeShape</span></a></span></span><span> </span><span class="hs-comment">-- See Note [Trimming a demand to a type]</span><span>
</span><span id="line-852"></span><span>               </span><span class="hs-comment">--     in GHC.Core.Opt.DmdAnal</span><span>
</span><span id="line-853"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="TsFun"><span class="annot"><a href="GHC.Types.Demand.html#TsFun"><span class="hs-identifier hs-var">TsFun</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#TypeShape"><span class="hs-identifier hs-type">TypeShape</span></a></span><span>
</span><span id="line-854"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="TsProd"><span class="annot"><a href="GHC.Types.Demand.html#TsProd"><span class="hs-identifier hs-var">TsProd</span></a></span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#TypeShape"><span class="hs-identifier hs-type">TypeShape</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-855"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="TsUnk"><span class="annot"><a href="GHC.Types.Demand.html#TsUnk"><span class="hs-identifier hs-var">TsUnk</span></a></span></span><span>
</span><span id="line-856"></span><span>
</span><span id="line-857"></span><span class="annot"><a href="GHC.Types.Demand.html#trimToType"><span class="hs-identifier hs-type">trimToType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#TypeShape"><span class="hs-identifier hs-type">TypeShape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-858"></span><span class="hs-comment">-- See Note [Trimming a demand to a type] in GHC.Core.Opt.DmdAnal</span><span>
</span><span id="line-859"></span><span id="trimToType"><span class="annot"><span class="annottext">trimToType :: Demand -&gt; TypeShape -&gt; Demand
</span><a href="GHC.Types.Demand.html#trimToType"><span class="hs-identifier hs-var hs-var">trimToType</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810243"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810243"><span class="hs-identifier hs-var">ms</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810242"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810242"><span class="hs-identifier hs-var">mu</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680810241"><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810241"><span class="hs-identifier hs-var">ts</span></a></span></span><span>
</span><span id="line-860"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; ArgUse -&gt; Demand
forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-var">JD</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgStr -&gt; TypeShape -&gt; ArgStr
</span><a href="#local-6989586621680810240"><span class="hs-identifier hs-var">go_ms</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810243"><span class="hs-identifier hs-var">ms</span></a></span><span> </span><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810241"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ArgUse -&gt; TypeShape -&gt; ArgUse
</span><a href="#local-6989586621680810239"><span class="hs-identifier hs-var">go_mu</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810242"><span class="hs-identifier hs-var">mu</span></a></span><span> </span><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810241"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-861"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-862"></span><span>    </span><span class="annot"><a href="#local-6989586621680810240"><span class="hs-identifier hs-type">go_ms</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#TypeShape"><span class="hs-identifier hs-type">TypeShape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span><span>
</span><span id="line-863"></span><span>    </span><span id="local-6989586621680810240"><span class="annot"><span class="annottext">go_ms :: ArgStr -&gt; TypeShape -&gt; ArgStr
</span><a href="#local-6989586621680810240"><span class="hs-identifier hs-var hs-var">go_ms</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>    </span><span class="annot"><span class="annottext">TypeShape
</span><span class="hs-identifier">_</span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>
</span><span id="line-864"></span><span>    </span><span class="annot"><a href="#local-6989586621680810240"><span class="hs-identifier hs-var">go_ms</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span id="local-6989586621680810238"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810238"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680810237"><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810237"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd -&gt; TypeShape -&gt; StrDmd
</span><a href="#local-6989586621680810236"><span class="hs-identifier hs-var">go_s</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810238"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810237"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-865"></span><span>
</span><span id="line-866"></span><span>    </span><span class="annot"><a href="#local-6989586621680810236"><span class="hs-identifier hs-type">go_s</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#TypeShape"><span class="hs-identifier hs-type">TypeShape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span>
</span><span id="line-867"></span><span>    </span><span id="local-6989586621680810236"><span class="annot"><span class="annottext">go_s :: StrDmd -&gt; TypeShape -&gt; StrDmd
</span><a href="#local-6989586621680810236"><span class="hs-identifier hs-var hs-var">go_s</span></a></span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>    </span><span class="annot"><span class="annottext">TypeShape
</span><span class="hs-identifier">_</span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>
</span><span id="line-868"></span><span>    </span><span class="annot"><a href="#local-6989586621680810236"><span class="hs-identifier hs-var">go_s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680810235"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810235"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#TsFun"><span class="hs-identifier hs-type">TsFun</span></a></span><span> </span><span id="local-6989586621680810234"><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810234"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-var">SCall</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd -&gt; TypeShape -&gt; StrDmd
</span><a href="#local-6989586621680810236"><span class="hs-identifier hs-var">go_s</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810235"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810234"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-869"></span><span>    </span><span class="annot"><a href="#local-6989586621680810236"><span class="hs-identifier hs-var">go_s</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span id="local-6989586621680810233"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810233"><span class="hs-identifier hs-var">mss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#TsProd"><span class="hs-identifier hs-type">TsProd</span></a></span><span> </span><span id="local-6989586621680810232"><span class="annot"><span class="annottext">[TypeShape]
</span><a href="#local-6989586621680810232"><span class="hs-identifier hs-var">tss</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-870"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; [TypeShape] -&gt; Bool
forall a b. [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-identifier hs-var">equalLength</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810233"><span class="hs-identifier hs-var">mss</span></a></span><span> </span><span class="annot"><span class="annottext">[TypeShape]
</span><a href="#local-6989586621680810232"><span class="hs-identifier hs-var">tss</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgStr] -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-var">SProd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgStr -&gt; TypeShape -&gt; ArgStr)
-&gt; [ArgStr] -&gt; [TypeShape] -&gt; [ArgStr]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; TypeShape -&gt; ArgStr
</span><a href="#local-6989586621680810240"><span class="hs-identifier hs-var">go_ms</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680810233"><span class="hs-identifier hs-var">mss</span></a></span><span> </span><span class="annot"><span class="annottext">[TypeShape]
</span><a href="#local-6989586621680810232"><span class="hs-identifier hs-var">tss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-871"></span><span>    </span><span class="annot"><a href="#local-6989586621680810236"><span class="hs-identifier hs-var">go_s</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span>           </span><span class="annot"><span class="annottext">TypeShape
</span><span class="hs-identifier">_</span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>
</span><span id="line-872"></span><span>
</span><span id="line-873"></span><span>    </span><span class="annot"><a href="#local-6989586621680810239"><span class="hs-identifier hs-type">go_mu</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#TypeShape"><span class="hs-identifier hs-type">TypeShape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span>
</span><span id="line-874"></span><span>    </span><span id="local-6989586621680810239"><span class="annot"><span class="annottext">go_mu :: ArgUse -&gt; TypeShape -&gt; ArgUse
</span><a href="#local-6989586621680810239"><span class="hs-identifier hs-var hs-var">go_mu</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span> </span><span class="annot"><span class="annottext">TypeShape
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
forall u. Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>
</span><span id="line-875"></span><span>    </span><span class="annot"><a href="#local-6989586621680810239"><span class="hs-identifier hs-var">go_mu</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span id="local-6989586621680810231"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810231"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680810230"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810230"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680810229"><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810229"><span class="hs-identifier hs-var">ts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810231"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UseDmd -&gt; TypeShape -&gt; UseDmd
</span><a href="#local-6989586621680810228"><span class="hs-identifier hs-var">go_u</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810230"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810229"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-876"></span><span>
</span><span id="line-877"></span><span>    </span><span class="annot"><a href="#local-6989586621680810228"><span class="hs-identifier hs-type">go_u</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#TypeShape"><span class="hs-identifier hs-type">TypeShape</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span>
</span><span id="line-878"></span><span>    </span><span id="local-6989586621680810228"><span class="annot"><span class="annottext">go_u :: UseDmd -&gt; TypeShape -&gt; UseDmd
</span><a href="#local-6989586621680810228"><span class="hs-identifier hs-var hs-var">go_u</span></a></span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>       </span><span class="annot"><span class="annottext">TypeShape
</span><span class="hs-identifier">_</span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>
</span><span id="line-879"></span><span>    </span><span class="annot"><a href="#local-6989586621680810228"><span class="hs-identifier hs-var">go_u</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span id="local-6989586621680810227"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810227"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680810226"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810226"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#TsFun"><span class="hs-identifier hs-type">TsFun</span></a></span><span> </span><span id="local-6989586621680810225"><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810225"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810227"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UseDmd -&gt; TypeShape -&gt; UseDmd
</span><a href="#local-6989586621680810228"><span class="hs-identifier hs-var">go_u</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810226"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810225"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-880"></span><span>    </span><span class="annot"><a href="#local-6989586621680810228"><span class="hs-identifier hs-var">go_u</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680810224"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810224"><span class="hs-identifier hs-var">mus</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#TsProd"><span class="hs-identifier hs-type">TsProd</span></a></span><span> </span><span id="local-6989586621680810223"><span class="annot"><span class="annottext">[TypeShape]
</span><a href="#local-6989586621680810223"><span class="hs-identifier hs-var">tss</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-881"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; [TypeShape] -&gt; Bool
forall a b. [a] -&gt; [b] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#equalLength"><span class="hs-identifier hs-var">equalLength</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810224"><span class="hs-identifier hs-var">mus</span></a></span><span> </span><span class="annot"><span class="annottext">[TypeShape]
</span><a href="#local-6989586621680810223"><span class="hs-identifier hs-var">tss</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgUse -&gt; TypeShape -&gt; ArgUse)
-&gt; [ArgUse] -&gt; [TypeShape] -&gt; [ArgUse]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; TypeShape -&gt; ArgUse
</span><a href="#local-6989586621680810239"><span class="hs-identifier hs-var">go_mu</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680810224"><span class="hs-identifier hs-var">mus</span></a></span><span> </span><span class="annot"><span class="annottext">[TypeShape]
</span><a href="#local-6989586621680810223"><span class="hs-identifier hs-var">tss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-882"></span><span>    </span><span class="annot"><a href="#local-6989586621680810228"><span class="hs-identifier hs-var">go_u</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>           </span><span class="annot"><span class="annottext">TypeShape
</span><span class="hs-identifier">_</span></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>
</span><span id="line-883"></span><span>
</span><span id="line-884"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680810220"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#TypeShape"><span class="hs-identifier hs-type">TypeShape</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-885"></span><span>  </span><span id="local-6989586621680810217"><span class="annot"><span class="annottext">ppr :: TypeShape -&gt; SDoc
</span><a href="#local-6989586621680810217"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">TypeShape
</span><a href="GHC.Types.Demand.html#TsUnk"><span class="hs-identifier hs-var">TsUnk</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;TsUnk&quot;</span></span><span>
</span><span id="line-886"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#TsFun"><span class="hs-identifier hs-type">TsFun</span></a></span><span> </span><span id="local-6989586621680810216"><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810216"><span class="hs-identifier hs-var">ts</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;TsFun&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TypeShape -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TypeShape
</span><a href="#local-6989586621680810216"><span class="hs-identifier hs-var">ts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-887"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#TsProd"><span class="hs-identifier hs-type">TsProd</span></a></span><span> </span><span id="local-6989586621680810215"><span class="annot"><span class="annottext">[TypeShape]
</span><a href="#local-6989586621680810215"><span class="hs-identifier hs-var">tss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hsep"><span class="hs-identifier hs-var">hsep</span></a></span><span> </span><span class="annot"><span class="annottext">([SDoc] -&gt; SDoc) -&gt; [SDoc] -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; [SDoc] -&gt; [SDoc]
</span><a href="GHC.Utils.Outputable.html#punctuate"><span class="hs-identifier hs-var">punctuate</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#comma"><span class="hs-identifier hs-var">comma</span></a></span><span> </span><span class="annot"><span class="annottext">([SDoc] -&gt; [SDoc]) -&gt; [SDoc] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(TypeShape -&gt; SDoc) -&gt; [TypeShape] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">TypeShape -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[TypeShape]
</span><a href="#local-6989586621680810215"><span class="hs-identifier hs-var">tss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-888"></span><span>
</span><span id="line-889"></span><span>
</span><span id="line-890"></span><span>
</span><span id="line-891"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
                   Termination
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-896"></span><span>
</span><span id="line-897"></span><span class="hs-comment">-- | Divergence lattice. Models a subset lattice of the following exhaustive</span><span>
</span><span id="line-898"></span><span class="hs-comment">-- set of divergence results:</span><span>
</span><span id="line-899"></span><span class="hs-comment">--</span><span>
</span><span id="line-900"></span><span class="hs-comment">-- [n] nontermination (e.g. loops)</span><span>
</span><span id="line-901"></span><span class="hs-comment">-- [i] throws imprecise exception</span><span>
</span><span id="line-902"></span><span class="hs-comment">-- [p] throws precise exception</span><span>
</span><span id="line-903"></span><span class="hs-comment">-- [c] converges (reduces to WHNF)</span><span>
</span><span id="line-904"></span><span class="hs-comment">--</span><span>
</span><span id="line-905"></span><span class="hs-comment">-- The different lattice elements correspond to different subsets, indicated by</span><span>
</span><span id="line-906"></span><span class="hs-comment">-- juxtaposition of indicators (e.g. __nc__ definitely doesn't throw an</span><span>
</span><span id="line-907"></span><span class="hs-comment">-- exception, and may or may not reduce to WHNF).</span><span>
</span><span id="line-908"></span><span class="hs-comment">--</span><span>
</span><span id="line-909"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-910"></span><span class="hs-comment">--             Dunno (nipc)</span><span>
</span><span id="line-911"></span><span class="hs-comment">--                  |</span><span>
</span><span id="line-912"></span><span class="hs-comment">--            ExnOrDiv (nip)</span><span>
</span><span id="line-913"></span><span class="hs-comment">--                  |</span><span>
</span><span id="line-914"></span><span class="hs-comment">--            Diverges (ni)</span><span>
</span><span id="line-915"></span><span class="hs-comment">-- @</span><span>
</span><span id="line-916"></span><span class="hs-comment">--</span><span>
</span><span id="line-917"></span><span class="hs-comment">-- As you can see, we don't distinguish __n__ and __i__.</span><span>
</span><span id="line-918"></span><span class="hs-comment">-- See Note [Precise exceptions and strictness analysis] for why __p__ is so</span><span>
</span><span id="line-919"></span><span class="hs-comment">-- special compared to __i__.</span><span>
</span><span id="line-920"></span><span class="hs-keyword">data</span><span> </span><span id="Divergence"><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-var">Divergence</span></a></span></span><span>
</span><span id="line-921"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="Diverges"><span class="annot"><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span></span><span> </span><span class="hs-comment">-- ^ Definitely throws an imprecise exception or diverges.</span><span>
</span><span id="line-922"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="ExnOrDiv"><span class="annot"><a href="GHC.Types.Demand.html#ExnOrDiv"><span class="hs-identifier hs-var">ExnOrDiv</span></a></span></span><span> </span><span class="hs-comment">-- ^ Definitely throws a *precise* exception, an imprecise</span><span>
</span><span id="line-923"></span><span>             </span><span class="hs-comment">--   exception or diverges. Never converges, hence 'isDeadEndDiv'!</span><span>
</span><span id="line-924"></span><span>             </span><span class="hs-comment">--   See scenario 1 in Note [Precise exceptions and strictness analysis].</span><span>
</span><span id="line-925"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="Dunno"><span class="annot"><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span></span><span>    </span><span class="hs-comment">-- ^ Might diverge, throw any kind of exception or converge.</span><span>
</span><span id="line-926"></span><span>  </span><span class="hs-keyword">deriving</span><span class="hs-special">(</span><span> </span><span id="local-6989586621680810206"><span id="local-6989586621680810208"><span class="annot"><span class="annottext">Divergence -&gt; Divergence -&gt; Bool
(Divergence -&gt; Divergence -&gt; Bool)
-&gt; (Divergence -&gt; Divergence -&gt; Bool) -&gt; Eq Divergence
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: Divergence -&gt; Divergence -&gt; Bool
$c/= :: Divergence -&gt; Divergence -&gt; Bool
== :: Divergence -&gt; Divergence -&gt; Bool
$c== :: Divergence -&gt; Divergence -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810200"><span id="local-6989586621680810202"><span id="local-6989586621680810204"><span class="annot"><span class="annottext">Int -&gt; Divergence -&gt; ShowS
[Divergence] -&gt; ShowS
Divergence -&gt; String
(Int -&gt; Divergence -&gt; ShowS)
-&gt; (Divergence -&gt; String)
-&gt; ([Divergence] -&gt; ShowS)
-&gt; Show Divergence
forall a.
(Int -&gt; a -&gt; ShowS) -&gt; (a -&gt; String) -&gt; ([a] -&gt; ShowS) -&gt; Show a
showList :: [Divergence] -&gt; ShowS
$cshowList :: [Divergence] -&gt; ShowS
show :: Divergence -&gt; String
$cshow :: Divergence -&gt; String
showsPrec :: Int -&gt; Divergence -&gt; ShowS
$cshowsPrec :: Int -&gt; Divergence -&gt; ShowS
</span><a href="../../base/src/GHC.Show.html#Show"><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var hs-var hs-var">Show</span></a></span></span></span></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-927"></span><span>
</span><span id="line-928"></span><span class="annot"><a href="GHC.Types.Demand.html#lubDivergence"><span class="hs-identifier hs-type">lubDivergence</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span>
</span><span id="line-929"></span><span id="lubDivergence"><span class="annot"><span class="annottext">lubDivergence :: Divergence -&gt; Divergence -&gt; Divergence
</span><a href="GHC.Types.Demand.html#lubDivergence"><span class="hs-identifier hs-var hs-var">lubDivergence</span></a></span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span> </span><span id="local-6989586621680810199"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810199"><span class="hs-identifier hs-var">div</span></a></span></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810199"><span class="hs-identifier hs-var">div</span></a></span><span>
</span><span id="line-930"></span><span class="annot"><a href="GHC.Types.Demand.html#lubDivergence"><span class="hs-identifier hs-var">lubDivergence</span></a></span><span> </span><span id="local-6989586621680810198"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810198"><span class="hs-identifier hs-var">div</span></a></span></span><span>      </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810198"><span class="hs-identifier hs-var">div</span></a></span><span>
</span><span id="line-931"></span><span class="annot"><a href="GHC.Types.Demand.html#lubDivergence"><span class="hs-identifier hs-var">lubDivergence</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#ExnOrDiv"><span class="hs-identifier hs-var">ExnOrDiv</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#ExnOrDiv"><span class="hs-identifier hs-var">ExnOrDiv</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#ExnOrDiv"><span class="hs-identifier hs-var">ExnOrDiv</span></a></span><span>
</span><span id="line-932"></span><span class="annot"><a href="GHC.Types.Demand.html#lubDivergence"><span class="hs-identifier hs-var">lubDivergence</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span>        </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span><span>
</span><span id="line-933"></span><span class="hs-comment">-- This needs to commute with defaultFvDmd, i.e.</span><span>
</span><span id="line-934"></span><span class="hs-comment">-- defaultFvDmd (r1 `lubDivergence` r2) = defaultFvDmd r1 `lubDmd` defaultFvDmd r2</span><span>
</span><span id="line-935"></span><span class="hs-comment">-- (See Note [Default demand on free variables and arguments] for why)</span><span>
</span><span id="line-936"></span><span>
</span><span id="line-937"></span><span class="annot"><a href="GHC.Types.Demand.html#bothDivergence"><span class="hs-identifier hs-type">bothDivergence</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span>
</span><span id="line-938"></span><span class="hs-comment">-- See Note [Asymmetry of 'both*'], which concludes that 'bothDivergence' needs</span><span>
</span><span id="line-939"></span><span class="hs-comment">-- to be symmetric.</span><span>
</span><span id="line-940"></span><span class="hs-comment">-- Strictly speaking, we should have @bothDivergence Dunno Diverges = ExnOrDiv@.</span><span>
</span><span id="line-941"></span><span class="hs-comment">-- But that regresses in too many places (every infinite loop, basically) to be</span><span>
</span><span id="line-942"></span><span class="hs-comment">-- worth it and is only relevant in higher-order scenarios</span><span>
</span><span id="line-943"></span><span class="hs-comment">-- (e.g. Divergence of @f (throwIO blah)@).</span><span>
</span><span id="line-944"></span><span class="hs-comment">-- So 'bothDivergence' currently is 'glbDivergence', really.</span><span>
</span><span id="line-945"></span><span id="bothDivergence"><span class="annot"><span class="annottext">bothDivergence :: Divergence -&gt; Divergence -&gt; Divergence
</span><a href="GHC.Types.Demand.html#bothDivergence"><span class="hs-identifier hs-var hs-var">bothDivergence</span></a></span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span><span>    </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span><span>
</span><span id="line-946"></span><span class="annot"><a href="GHC.Types.Demand.html#bothDivergence"><span class="hs-identifier hs-var">bothDivergence</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span>
</span><span id="line-947"></span><span class="annot"><a href="GHC.Types.Demand.html#bothDivergence"><span class="hs-identifier hs-var">bothDivergence</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span>        </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span>
</span><span id="line-948"></span><span class="annot"><a href="GHC.Types.Demand.html#bothDivergence"><span class="hs-identifier hs-var">bothDivergence</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span>        </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#ExnOrDiv"><span class="hs-identifier hs-var">ExnOrDiv</span></a></span><span>
</span><span id="line-949"></span><span>
</span><span id="line-950"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680810194"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-951"></span><span>  </span><span id="local-6989586621680810193"><span class="annot"><span class="annottext">ppr :: Divergence -&gt; SDoc
</span><a href="#local-6989586621680810193"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'b'</span></span><span> </span><span class="hs-comment">-- for (b)ottom</span><span>
</span><span id="line-952"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#ExnOrDiv"><span class="hs-identifier hs-var">ExnOrDiv</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Char -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#char"><span class="hs-identifier hs-var">char</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'x'</span></span><span> </span><span class="hs-comment">-- for e(x)ception</span><span>
</span><span id="line-953"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-954"></span><span>
</span><span id="line-955"></span><span class="hs-comment">{- Note [Precise vs imprecise exceptions]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
An exception is considered to be /precise/ when it is thrown by the 'raiseIO#'
primop. It follows that all other primops (such as 'raise#' or
division-by-zero) throw /imprecise/ exceptions. Note that the actual type of
the exception thrown doesn't have any impact!

GHC undertakes some effort not to apply an optimisation that would mask a
/precise/ exception with some other source of nontermination, such as genuine
divergence or an imprecise exception, so that the user can reliably
intercept the precise exception with a catch handler before and after
optimisations.

See also the wiki page on precise exceptions:
https://gitlab.haskell.org/ghc/ghc/wikis/exceptions/precise-exceptions
Section 5 of &quot;Tackling the awkward squad&quot; talks about semantic concerns.
Imprecise exceptions are actually more interesting than precise ones (which are
fairly standard) from the perspective of semantics. See the paper &quot;A Semantics
for Imprecise Exceptions&quot; for more details.

Note [Dead ends]
~~~~~~~~~~~~~~~~
We call an expression that either diverges or throws a precise or imprecise
exception a &quot;dead end&quot;. We used to call such an expression just &quot;bottoming&quot;,
but with the measures we take to preserve precise exception semantics
(see Note [Precise exceptions and strictness analysis]), that is no longer
accurate: 'exnDiv' is no longer the bottom of the Divergence lattice.

Yet externally to demand analysis, we mostly care about being able to drop dead
code etc., which is all due to the property that such an expression never
returns, hence we consider throwing a precise exception to be a dead end.
See also 'isDeadEndDiv'.

Note [Precise exceptions and strictness analysis]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We have to take care to preserve precise exception semantics in strictness
analysis (#17676). There are two scenarios that need careful treatment.

The fixes were discussed at
https://gitlab.haskell.org/ghc/ghc/wikis/fixing-precise-exceptions

Recall that raiseIO# raises a *precise* exception, in contrast to raise# which
raises an *imprecise* exception. See Note [Precise vs imprecise exceptions].

Scenario 1: Precise exceptions in case alternatives
---------------------------------------------------
Unlike raise# (which returns botDiv), we want raiseIO# to return exnDiv.
Here's why. Consider this example from #13380 (similarly #17676):
  f x y | x&gt;0       = raiseIO# Exc
        | y&gt;0       = return 1
        | otherwise = return 2
Is 'f' strict in 'y'? One might be tempted to say yes! But that plays fast and
loose with the precise exception; after optimisation, (f 42 (error &quot;boom&quot;))
turns from throwing the precise Exc to throwing the imprecise user error
&quot;boom&quot;. So, the defaultFvDmd of raiseIO# should be lazy (topDmd), which can be
achieved by giving it divergence exnDiv.
See Note [Default demand on free variables and arguments].

Why don't we just give it topDiv instead of introducing exnDiv?
Because then the simplifier will fail to discard raiseIO#'s continuation in
  case raiseIO# x s of { (# s', r #) -&gt; &lt;BIG&gt; }
which we'd like to optimise to
  case raiseIO# x s of {}
Hence we came up with exnDiv. The default FV demand of exnDiv is lazy (and
its default arg dmd is absent), but otherwise (in terms of 'isDeadEndDiv') it
behaves exactly as botDiv, so that dead code elimination works as expected.
This is tracked by T13380b.

Scenario 2: Precise exceptions in case scrutinees
-------------------------------------------------
Consider (more complete examples in #148, #1592, testcase strun003)

  case foo x s of { (# s', r #) -&gt; y }

Is this strict in 'y'? Often not! If @foo x s@ might throw a precise exception
(ultimately via raiseIO#), then we must not force 'y', which may fail to
terminate or throw an imprecise exception, until we have performed @foo x s@.

So we have to 'deferAfterPreciseException' (which 'lub's with 'exnDmdType' to
model the exceptional control flow) when @foo x s@ may throw a precise
exception. Motivated by T13380{d,e,f}.
See Note [Which scrutinees may throw precise exceptions] in &quot;GHC.Core.Opt.DmdAnal&quot;.

We have to be careful not to discard dead-end Divergence from case
alternatives, though (#18086):

  m = putStrLn &quot;foo&quot; &gt;&gt; error &quot;bar&quot;

'm' should still have 'exnDiv', which is why it is not sufficient to lub with
'nopDmdType' (which has 'topDiv') in 'deferAfterPreciseException'.

Historical Note: This used to be called the &quot;IO hack&quot;. But that term is rather
a bad fit because
1. It's easily confused with the &quot;State hack&quot;, which also affects IO.
2. Neither &quot;IO&quot; nor &quot;hack&quot; is a good description of what goes on here, which
   is deferring strictness results after possibly throwing a precise exception.
   The &quot;hack&quot; is probably not having to defer when we can prove that the
   expression may not throw a precise exception (increasing precision of the
   analysis), but that's just a favourable guess.
-}</span><span>
</span><span id="line-1055"></span><span>
</span><span id="line-1056"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-1057"></span><span class="hs-comment">-- Combined demand result                                             --</span><span>
</span><span id="line-1058"></span><span class="hs-comment">------------------------------------------------------------------------</span><span>
</span><span id="line-1059"></span><span>
</span><span id="line-1060"></span><span class="annot"><a href="GHC.Types.Demand.html#topDiv"><span class="hs-identifier hs-type">topDiv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#exnDiv"><span class="hs-identifier hs-type">exnDiv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#botDiv"><span class="hs-identifier hs-type">botDiv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span>
</span><span id="line-1061"></span><span id="topDiv"><span class="annot"><span class="annottext">topDiv :: Divergence
</span><a href="GHC.Types.Demand.html#topDiv"><span class="hs-identifier hs-var hs-var">topDiv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span><span>
</span><span id="line-1062"></span><span id="exnDiv"><span class="annot"><span class="annottext">exnDiv :: Divergence
</span><a href="GHC.Types.Demand.html#exnDiv"><span class="hs-identifier hs-var hs-var">exnDiv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#ExnOrDiv"><span class="hs-identifier hs-var">ExnOrDiv</span></a></span><span>
</span><span id="line-1063"></span><span id="botDiv"><span class="annot"><span class="annottext">botDiv :: Divergence
</span><a href="GHC.Types.Demand.html#botDiv"><span class="hs-identifier hs-var hs-var">botDiv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span>
</span><span id="line-1064"></span><span>
</span><span id="line-1065"></span><span class="hs-comment">-- | True if the result indicates that evaluation will not return.</span><span>
</span><span id="line-1066"></span><span class="hs-comment">-- See Note [Dead ends].</span><span>
</span><span id="line-1067"></span><span class="annot"><a href="GHC.Types.Demand.html#isDeadEndDiv"><span class="hs-identifier hs-type">isDeadEndDiv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1068"></span><span id="isDeadEndDiv"><span class="annot"><span class="annottext">isDeadEndDiv :: Divergence -&gt; Bool
</span><a href="GHC.Types.Demand.html#isDeadEndDiv"><span class="hs-identifier hs-var hs-var">isDeadEndDiv</span></a></span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1069"></span><span class="annot"><a href="GHC.Types.Demand.html#isDeadEndDiv"><span class="hs-identifier hs-var">isDeadEndDiv</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#ExnOrDiv"><span class="hs-identifier hs-var">ExnOrDiv</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1070"></span><span class="annot"><a href="GHC.Types.Demand.html#isDeadEndDiv"><span class="hs-identifier hs-var">isDeadEndDiv</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1071"></span><span>
</span><span id="line-1072"></span><span class="hs-comment">-- See Notes [Default demand on free variables and arguments]</span><span>
</span><span id="line-1073"></span><span class="hs-comment">-- and Scenario 1 in [Precise exceptions and strictness analysis]</span><span>
</span><span id="line-1074"></span><span class="annot"><a href="GHC.Types.Demand.html#defaultFvDmd"><span class="hs-identifier hs-type">defaultFvDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-1075"></span><span id="defaultFvDmd"><span class="annot"><span class="annottext">defaultFvDmd :: Divergence -&gt; Demand
</span><a href="GHC.Types.Demand.html#defaultFvDmd"><span class="hs-identifier hs-var hs-var">defaultFvDmd</span></a></span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="GHC.Types.Demand.html#absDmd"><span class="hs-identifier hs-var">absDmd</span></a></span><span>
</span><span id="line-1076"></span><span class="annot"><a href="GHC.Types.Demand.html#defaultFvDmd"><span class="hs-identifier hs-var">defaultFvDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#ExnOrDiv"><span class="hs-identifier hs-var">ExnOrDiv</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="GHC.Types.Demand.html#absDmd"><span class="hs-identifier hs-var">absDmd</span></a></span><span> </span><span class="hs-comment">-- This is the whole point of ExnOrDiv!</span><span>
</span><span id="line-1077"></span><span class="annot"><a href="GHC.Types.Demand.html#defaultFvDmd"><span class="hs-identifier hs-var">defaultFvDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="GHC.Types.Demand.html#botDmd"><span class="hs-identifier hs-var">botDmd</span></a></span><span> </span><span class="hs-comment">-- Diverges</span><span>
</span><span id="line-1078"></span><span>
</span><span id="line-1079"></span><span class="annot"><a href="GHC.Types.Demand.html#defaultArgDmd"><span class="hs-identifier hs-type">defaultArgDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-1080"></span><span class="hs-comment">-- TopRes and BotRes are polymorphic, so that</span><span>
</span><span id="line-1081"></span><span class="hs-comment">--      BotRes === (Bot -&gt; BotRes) === ...</span><span>
</span><span id="line-1082"></span><span class="hs-comment">--      TopRes === (Top -&gt; TopRes) === ...</span><span>
</span><span id="line-1083"></span><span class="hs-comment">-- This function makes that concrete</span><span>
</span><span id="line-1084"></span><span class="hs-comment">-- Also see Note [Default demand on free variables and arguments]</span><span>
</span><span id="line-1085"></span><span id="defaultArgDmd"><span class="annot"><span class="annottext">defaultArgDmd :: Divergence -&gt; Demand
</span><a href="GHC.Types.Demand.html#defaultArgDmd"><span class="hs-identifier hs-var hs-var">defaultArgDmd</span></a></span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="GHC.Types.Demand.html#topDmd"><span class="hs-identifier hs-var">topDmd</span></a></span><span>
</span><span id="line-1086"></span><span class="hs-comment">-- NB: not botDmd! We don't want to mask the precise exception by forcing the</span><span>
</span><span id="line-1087"></span><span class="hs-comment">-- argument. But it is still absent.</span><span>
</span><span id="line-1088"></span><span class="annot"><a href="GHC.Types.Demand.html#defaultArgDmd"><span class="hs-identifier hs-var">defaultArgDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#ExnOrDiv"><span class="hs-identifier hs-var">ExnOrDiv</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="GHC.Types.Demand.html#absDmd"><span class="hs-identifier hs-var">absDmd</span></a></span><span>
</span><span id="line-1089"></span><span class="annot"><a href="GHC.Types.Demand.html#defaultArgDmd"><span class="hs-identifier hs-var">defaultArgDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="GHC.Types.Demand.html#botDmd"><span class="hs-identifier hs-var">botDmd</span></a></span><span>
</span><span id="line-1090"></span><span>
</span><span id="line-1091"></span><span class="hs-comment">{- Note [Default demand on free variables and arguments]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Free variables not mentioned in the environment of a 'DmdType'
are demanded according to the demand type's Divergence:
  * In a Diverges (botDiv) context, that demand is botDmd
    (HyperStr and Absent).
  * In all other contexts, the demand is absDmd (Lazy and Absent).
This is recorded in 'defaultFvDmd'.

Similarly, we can eta-expand demand types to get demands on excess arguments
not accounted for in the type, by consulting 'defaultArgDmd':
  * In a Diverges (botDiv) context, that demand is again botDmd.
  * In a ExnOrDiv (exnDiv) context, that demand is absDmd: We surely diverge
    before evaluating the excess argument, but don't want to eagerly evaluate
    it (cf. Note [Precise exceptions and strictness analysis]).
  * In a Dunno context (topDiv), the demand is topDmd, because
    it's perfectly possible to enter the additional lambda and evaluate it
    in unforeseen ways (so, not Absent).


************************************************************************
*                                                                      *
           Demand environments and types
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-1117"></span><span>
</span><span id="line-1118"></span><span class="hs-keyword">type</span><span> </span><span id="DmdEnv"><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-var">DmdEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#VarEnv"><span class="hs-identifier hs-type">VarEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>   </span><span class="hs-comment">-- See Note [Default demand on free variables and arguments]</span><span>
</span><span id="line-1119"></span><span>
</span><span id="line-1120"></span><span class="hs-keyword">data</span><span> </span><span id="DmdType"><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="DmdType"><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span></span><span>
</span><span id="line-1121"></span><span>                  </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span>        </span><span class="hs-comment">-- Demand on explicitly-mentioned</span><span>
</span><span id="line-1122"></span><span>                                </span><span class="hs-comment">--      free variables</span><span>
</span><span id="line-1123"></span><span>                  </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span class="hs-special">]</span><span>      </span><span class="hs-comment">-- Demand on arguments</span><span>
</span><span id="line-1124"></span><span>                  </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span>     </span><span class="hs-comment">-- See [Demand type Divergence]</span><span>
</span><span id="line-1125"></span><span>
</span><span id="line-1126"></span><span class="hs-comment">{-
Note [Demand type Divergence]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In contrast to StrictSigs, DmdTypes are elicited under a specific incoming demand.
This is described in detail in Note [Understanding DmdType and StrictSig].
Here, we'll focus on what that means for a DmdType's Divergence in a higher-order
scenario.

Consider
  err x y = x `seq` y `seq` error (show x)
this has a strictness signature of
  &lt;S&gt;&lt;S&gt;b
meaning that we don't know what happens when we call errin weaker contexts than
C(C(S)), like @err `seq` ()@ (S) and @err 1 `seq` ()@ (C(S)). We may not unleash
the botDiv, hence assume topDiv. Of course, in @err 1 2 `seq` ()@ the incoming
demand C(C(S)) is strong enough and we see that the expression diverges.

Now consider a function
  f g = g 1 2
with signature &lt;C(S)&gt;, and the expression
  f err `seq` ()
now f puts a strictness demand of C(C(S)) onto its argument, which is unleashed
on err via the App rule. In contrast to weaker head strictness, this demand is
strong enough to unleash err's signature and hence we see that the whole
expression diverges!

Note [Asymmetry of 'both*']
~~~~~~~~~~~~~~~~~~~~~~~~~~~
'both' for DmdTypes is *asymmetrical*, because there can only one
be one type contributing argument demands!  For example, given (e1 e2), we get
a DmdType dt1 for e1, use its arg demand to analyse e2 giving dt2, and then do
(dt1 `bothType` dt2). Similarly with
  case e of { p -&gt; rhs }
we get dt_scrut from the scrutinee and dt_rhs from the RHS, and then
compute (dt_rhs `bothType` dt_scrut).

We
 1. combine the information on the free variables,
 2. take the demand on arguments from the first argument
 3. combine the termination results, as in bothDivergence.

Since we don't use argument demands of the second argument anyway, 'both's
second argument is just a 'BothDmdType'.

But note that the argument demand types are not guaranteed to be observed in
left to right order. For example, analysis of a case expression will pass the
demand type for the alts as the left argument and the type for the scrutinee as
the right argument. Also, it is not at all clear if there is such an order;
consider the LetUp case, where the RHS might be forced at any point while
evaluating the let body.
Therefore, it is crucial that 'bothDivergence' is symmetric!
-}</span><span>
</span><span id="line-1178"></span><span>
</span><span id="line-1179"></span><span class="hs-comment">-- Equality needed for fixpoints in GHC.Core.Opt.DmdAnal</span><span>
</span><span id="line-1180"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680810186"><span class="annot"><span class="hs-identifier hs-type">Eq</span></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1181"></span><span>  </span><span id="local-6989586621680810175"><span class="annot"><span class="annottext">== :: DmdType -&gt; DmdType -&gt; Bool
</span><span class="hs-operator hs-var hs-var hs-var hs-var">(==)</span></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810174"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810174"><span class="hs-identifier hs-var">fv1</span></a></span></span><span> </span><span id="local-6989586621680810173"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810173"><span class="hs-identifier hs-var">ds1</span></a></span></span><span> </span><span id="local-6989586621680810172"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810172"><span class="hs-identifier hs-var">div1</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1182"></span><span>       </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810171"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810171"><span class="hs-identifier hs-var">fv2</span></a></span></span><span> </span><span id="local-6989586621680810170"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810170"><span class="hs-identifier hs-var">ds2</span></a></span></span><span> </span><span id="local-6989586621680810169"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810169"><span class="hs-identifier hs-var">div2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [(Unique, Demand)]
forall key elt. UniqFM key elt -&gt; [(Unique, elt)]
</span><a href="GHC.Types.Unique.FM.html#nonDetUFMToList"><span class="hs-identifier hs-var">nonDetUFMToList</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810174"><span class="hs-identifier hs-var">fv1</span></a></span><span> </span><span class="annot"><span class="annottext">[(Unique, Demand)] -&gt; [(Unique, Demand)] -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [(Unique, Demand)]
forall key elt. UniqFM key elt -&gt; [(Unique, elt)]
</span><a href="GHC.Types.Unique.FM.html#nonDetUFMToList"><span class="hs-identifier hs-var">nonDetUFMToList</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810171"><span class="hs-identifier hs-var">fv2</span></a></span><span>
</span><span id="line-1183"></span><span>         </span><span class="hs-comment">-- It's OK to use nonDetUFMToList here because we're testing for</span><span>
</span><span id="line-1184"></span><span>         </span><span class="hs-comment">-- equality and even though the lists will be in some arbitrary</span><span>
</span><span id="line-1185"></span><span>         </span><span class="hs-comment">-- Unique order, it is the same order for both</span><span>
</span><span id="line-1186"></span><span>                              </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810173"><span class="hs-identifier hs-var">ds1</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; [Demand] -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810170"><span class="hs-identifier hs-var">ds2</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810172"><span class="hs-identifier hs-var">div1</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; Divergence -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810169"><span class="hs-identifier hs-var">div2</span></a></span><span>
</span><span id="line-1187"></span><span>
</span><span id="line-1188"></span><span class="hs-comment">-- | Compute the least upper bound of two 'DmdType's elicited /by the same</span><span>
</span><span id="line-1189"></span><span class="hs-comment">-- incoming demand/!</span><span>
</span><span id="line-1190"></span><span class="annot"><a href="GHC.Types.Demand.html#lubDmdType"><span class="hs-identifier hs-type">lubDmdType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1191"></span><span id="lubDmdType"><span class="annot"><span class="annottext">lubDmdType :: DmdType -&gt; DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#lubDmdType"><span class="hs-identifier hs-var hs-var">lubDmdType</span></a></span></span><span> </span><span id="local-6989586621680810167"><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810167"><span class="hs-identifier hs-var">d1</span></a></span></span><span> </span><span id="local-6989586621680810166"><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810166"><span class="hs-identifier hs-var">d2</span></a></span></span><span>
</span><span id="line-1192"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810165"><span class="hs-identifier hs-var">lub_fv</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810164"><span class="hs-identifier hs-var">lub_ds</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810163"><span class="hs-identifier hs-var">lub_div</span></a></span><span>
</span><span id="line-1193"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1194"></span><span>    </span><span id="local-6989586621680810161"><span class="annot"><span class="annottext">n :: Int
</span><a href="#local-6989586621680810161"><span class="hs-identifier hs-var hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Ord a =&gt; a -&gt; a -&gt; a
</span><span class="hs-identifier hs-var">max</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdType -&gt; Int
</span><a href="GHC.Types.Demand.html#dmdTypeDepth"><span class="hs-identifier hs-var">dmdTypeDepth</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810167"><span class="hs-identifier hs-var">d1</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdType -&gt; Int
</span><a href="GHC.Types.Demand.html#dmdTypeDepth"><span class="hs-identifier hs-var">dmdTypeDepth</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810166"><span class="hs-identifier hs-var">d2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1195"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810159"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810159"><span class="hs-identifier hs-var">fv1</span></a></span></span><span> </span><span id="local-6989586621680810158"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810158"><span class="hs-identifier hs-var">ds1</span></a></span></span><span> </span><span id="local-6989586621680810157"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810157"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#etaExpandDmdType"><span class="hs-identifier hs-var">etaExpandDmdType</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810161"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810167"><span class="hs-identifier hs-var">d1</span></a></span><span>
</span><span id="line-1196"></span><span>    </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810155"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810155"><span class="hs-identifier hs-var">fv2</span></a></span></span><span> </span><span id="local-6989586621680810154"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810154"><span class="hs-identifier hs-var">ds2</span></a></span></span><span> </span><span id="local-6989586621680810153"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810153"><span class="hs-identifier hs-var">r2</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#etaExpandDmdType"><span class="hs-identifier hs-var">etaExpandDmdType</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810161"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810166"><span class="hs-identifier hs-var">d2</span></a></span><span>
</span><span id="line-1197"></span><span>
</span><span id="line-1198"></span><span>    </span><span id="local-6989586621680810165"><span class="annot"><span class="annottext">lub_fv :: DmdEnv
</span><a href="#local-6989586621680810165"><span class="hs-identifier hs-var hs-var">lub_fv</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Demand -&gt; Demand -&gt; Demand)
-&gt; DmdEnv -&gt; Demand -&gt; DmdEnv -&gt; Demand -&gt; DmdEnv
forall a.
(a -&gt; a -&gt; a) -&gt; VarEnv a -&gt; a -&gt; VarEnv a -&gt; a -&gt; VarEnv a
</span><a href="GHC.Types.Var.Env.html#plusVarEnv_CD"><span class="hs-identifier hs-var">plusVarEnv_CD</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#lubDmd"><span class="hs-identifier hs-var">lubDmd</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810159"><span class="hs-identifier hs-var">fv1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Divergence -&gt; Demand
</span><a href="GHC.Types.Demand.html#defaultFvDmd"><span class="hs-identifier hs-var">defaultFvDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810157"><span class="hs-identifier hs-var">r1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810155"><span class="hs-identifier hs-var">fv2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Divergence -&gt; Demand
</span><a href="GHC.Types.Demand.html#defaultFvDmd"><span class="hs-identifier hs-var">defaultFvDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810153"><span class="hs-identifier hs-var">r2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1199"></span><span>    </span><span id="local-6989586621680810164"><span class="annot"><span class="annottext">lub_ds :: [Demand]
</span><a href="#local-6989586621680810164"><span class="hs-identifier hs-var hs-var">lub_ds</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String
-&gt; (Demand -&gt; Demand -&gt; Demand) -&gt; [Demand] -&gt; [Demand] -&gt; [Demand]
forall a b c. String -&gt; (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="GHC.Utils.Misc.html#zipWithEqual"><span class="hs-identifier hs-var">zipWithEqual</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;lubDmdType&quot;</span></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#lubDmd"><span class="hs-identifier hs-var">lubDmd</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810158"><span class="hs-identifier hs-var">ds1</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810154"><span class="hs-identifier hs-var">ds2</span></a></span><span>
</span><span id="line-1200"></span><span>    </span><span id="local-6989586621680810163"><span class="annot"><span class="annottext">lub_div :: Divergence
</span><a href="#local-6989586621680810163"><span class="hs-identifier hs-var hs-var">lub_div</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; Divergence -&gt; Divergence
</span><a href="GHC.Types.Demand.html#lubDivergence"><span class="hs-identifier hs-var">lubDivergence</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810157"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810153"><span class="hs-identifier hs-var">r2</span></a></span><span>
</span><span id="line-1201"></span><span>
</span><span id="line-1202"></span><span class="hs-keyword">type</span><span> </span><span id="BothDmdArg"><span class="annot"><a href="GHC.Types.Demand.html#BothDmdArg"><span class="hs-identifier hs-var">BothDmdArg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1203"></span><span>
</span><span id="line-1204"></span><span class="annot"><a href="GHC.Types.Demand.html#mkBothDmdArg"><span class="hs-identifier hs-type">mkBothDmdArg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#BothDmdArg"><span class="hs-identifier hs-type">BothDmdArg</span></a></span><span>
</span><span id="line-1205"></span><span id="mkBothDmdArg"><span class="annot"><span class="annottext">mkBothDmdArg :: DmdEnv -&gt; BothDmdArg
</span><a href="GHC.Types.Demand.html#mkBothDmdArg"><span class="hs-identifier hs-var hs-var">mkBothDmdArg</span></a></span></span><span> </span><span id="local-6989586621680810151"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810151"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810151"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#topDiv"><span class="hs-identifier hs-var">topDiv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1206"></span><span>
</span><span id="line-1207"></span><span class="annot"><a href="GHC.Types.Demand.html#toBothDmdArg"><span class="hs-identifier hs-type">toBothDmdArg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#BothDmdArg"><span class="hs-identifier hs-type">BothDmdArg</span></a></span><span>
</span><span id="line-1208"></span><span id="toBothDmdArg"><span class="annot"><span class="annottext">toBothDmdArg :: DmdType -&gt; BothDmdArg
</span><a href="GHC.Types.Demand.html#toBothDmdArg"><span class="hs-identifier hs-var hs-var">toBothDmdArg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810150"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810150"><span class="hs-identifier hs-var">fv</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810149"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810149"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810150"><span class="hs-identifier hs-var">fv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810149"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1209"></span><span>
</span><span id="line-1210"></span><span class="annot"><a href="GHC.Types.Demand.html#bothDmdType"><span class="hs-identifier hs-type">bothDmdType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#BothDmdArg"><span class="hs-identifier hs-type">BothDmdArg</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1211"></span><span id="bothDmdType"><span class="annot"><span class="annottext">bothDmdType :: DmdType -&gt; BothDmdArg -&gt; DmdType
</span><a href="GHC.Types.Demand.html#bothDmdType"><span class="hs-identifier hs-var hs-var">bothDmdType</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810148"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810148"><span class="hs-identifier hs-var">fv1</span></a></span></span><span> </span><span id="local-6989586621680810147"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810147"><span class="hs-identifier hs-var">ds1</span></a></span></span><span> </span><span id="local-6989586621680810146"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810146"><span class="hs-identifier hs-var">r1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680810145"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810145"><span class="hs-identifier hs-var">fv2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810144"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810144"><span class="hs-identifier hs-var">t2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1212"></span><span>    </span><span class="hs-comment">-- See Note [Asymmetry of 'both*']</span><span>
</span><span id="line-1213"></span><span>    </span><span class="hs-comment">-- 'both' takes the argument/result info from its *first* arg,</span><span>
</span><span id="line-1214"></span><span>    </span><span class="hs-comment">-- using its second arg just for its free-var info.</span><span>
</span><span id="line-1215"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Demand -&gt; Demand -&gt; Demand)
-&gt; DmdEnv -&gt; Demand -&gt; DmdEnv -&gt; Demand -&gt; DmdEnv
forall a.
(a -&gt; a -&gt; a) -&gt; VarEnv a -&gt; a -&gt; VarEnv a -&gt; a -&gt; VarEnv a
</span><a href="GHC.Types.Var.Env.html#plusVarEnv_CD"><span class="hs-identifier hs-var">plusVarEnv_CD</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#bothDmd"><span class="hs-identifier hs-var">bothDmd</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810148"><span class="hs-identifier hs-var">fv1</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Divergence -&gt; Demand
</span><a href="GHC.Types.Demand.html#defaultFvDmd"><span class="hs-identifier hs-var">defaultFvDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810146"><span class="hs-identifier hs-var">r1</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810145"><span class="hs-identifier hs-var">fv2</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Divergence -&gt; Demand
</span><a href="GHC.Types.Demand.html#defaultFvDmd"><span class="hs-identifier hs-var">defaultFvDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810144"><span class="hs-identifier hs-var">t2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1216"></span><span>            </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810147"><span class="hs-identifier hs-var">ds1</span></a></span><span>
</span><span id="line-1217"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810146"><span class="hs-identifier hs-var">r1</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; Divergence -&gt; Divergence
</span><a href="GHC.Types.Demand.html#bothDivergence"><span class="hs-operator hs-var">`bothDivergence`</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810144"><span class="hs-identifier hs-var">t2</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1218"></span><span>
</span><span id="line-1219"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680810141"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1220"></span><span>  </span><span id="local-6989586621680810134"><span class="annot"><span class="annottext">ppr :: DmdType -&gt; SDoc
</span><a href="#local-6989586621680810134"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810133"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810133"><span class="hs-identifier hs-var">fv</span></a></span></span><span> </span><span id="local-6989586621680810132"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810132"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span id="local-6989586621680810131"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810131"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1221"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hsep"><span class="hs-identifier hs-var">hsep</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hcat"><span class="hs-identifier hs-var">hcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Demand -&gt; SDoc) -&gt; [Demand] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810132"><span class="hs-identifier hs-var">ds</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810131"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1222"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[(Unique, Demand)] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[(Unique, Demand)]
</span><a href="#local-6989586621680810129"><span class="hs-identifier hs-var">fv_elts</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1223"></span><span>            </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#braces"><span class="hs-identifier hs-var">braces</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#fsep"><span class="hs-identifier hs-var">fsep</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((Unique, Demand) -&gt; SDoc) -&gt; [(Unique, Demand)] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(Unique, Demand) -&gt; SDoc
forall {a} {a}. (Outputable a, Outputable a) =&gt; (a, a) -&gt; SDoc
</span><a href="#local-6989586621680810126"><span class="hs-identifier hs-var">pp_elt</span></a></span><span> </span><span class="annot"><span class="annottext">[(Unique, Demand)]
</span><a href="#local-6989586621680810129"><span class="hs-identifier hs-var">fv_elts</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1224"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-1225"></span><span>      </span><span id="local-6989586621680810126"><span class="annot"><span class="annottext">pp_elt :: (a, a) -&gt; SDoc
</span><a href="#local-6989586621680810126"><span class="hs-identifier hs-var hs-var">pp_elt</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680810121"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680810121"><span class="hs-identifier hs-var">uniq</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810120"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680810120"><span class="hs-identifier hs-var">dmd</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680810121"><span class="hs-identifier hs-var">uniq</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-&gt;&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680810120"><span class="hs-identifier hs-var">dmd</span></a></span><span>
</span><span id="line-1226"></span><span>      </span><span id="local-6989586621680810129"><span class="annot"><span class="annottext">fv_elts :: [(Unique, Demand)]
</span><a href="#local-6989586621680810129"><span class="hs-identifier hs-var hs-var">fv_elts</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [(Unique, Demand)]
forall key elt. UniqFM key elt -&gt; [(Unique, elt)]
</span><a href="GHC.Types.Unique.FM.html#nonDetUFMToList"><span class="hs-identifier hs-var">nonDetUFMToList</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810133"><span class="hs-identifier hs-var">fv</span></a></span><span>
</span><span id="line-1227"></span><span>        </span><span class="hs-comment">-- It's OK to use nonDetUFMToList here because we only do it for</span><span>
</span><span id="line-1228"></span><span>        </span><span class="hs-comment">-- pretty printing</span><span>
</span><span id="line-1229"></span><span>
</span><span id="line-1230"></span><span class="annot"><a href="GHC.Types.Demand.html#emptyDmdEnv"><span class="hs-identifier hs-type">emptyDmdEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#VarEnv"><span class="hs-identifier hs-type">VarEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-1231"></span><span id="emptyDmdEnv"><span class="annot"><span class="annottext">emptyDmdEnv :: DmdEnv
</span><a href="GHC.Types.Demand.html#emptyDmdEnv"><span class="hs-identifier hs-var hs-var">emptyDmdEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv
forall a. VarEnv a
</span><a href="GHC.Types.Var.Env.html#emptyVarEnv"><span class="hs-identifier hs-var">emptyVarEnv</span></a></span><span>
</span><span id="line-1232"></span><span>
</span><span id="line-1233"></span><span class="annot"><a href="GHC.Types.Demand.html#botDmdType"><span class="hs-identifier hs-type">botDmdType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1234"></span><span id="botDmdType"><span class="annot"><span class="annottext">botDmdType :: DmdType
</span><a href="GHC.Types.Demand.html#botDmdType"><span class="hs-identifier hs-var hs-var">botDmdType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="GHC.Types.Demand.html#emptyDmdEnv"><span class="hs-identifier hs-var">emptyDmdEnv</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#botDiv"><span class="hs-identifier hs-var">botDiv</span></a></span><span>
</span><span id="line-1235"></span><span>
</span><span id="line-1236"></span><span class="hs-comment">-- | The demand type of doing nothing (lazy, absent, no Divergence</span><span>
</span><span id="line-1237"></span><span class="hs-comment">-- information). Note that it is ''not'' the top of the lattice (which would be</span><span>
</span><span id="line-1238"></span><span class="hs-comment">-- &quot;may use everything&quot;), so it is (no longer) called topDmdType.</span><span>
</span><span id="line-1239"></span><span class="hs-comment">-- (SG: I agree, but why is it still 'topDmd' then?)</span><span>
</span><span id="line-1240"></span><span class="annot"><a href="GHC.Types.Demand.html#nopDmdType"><span class="hs-identifier hs-type">nopDmdType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1241"></span><span id="nopDmdType"><span class="annot"><span class="annottext">nopDmdType :: DmdType
</span><a href="GHC.Types.Demand.html#nopDmdType"><span class="hs-identifier hs-var hs-var">nopDmdType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="GHC.Types.Demand.html#emptyDmdEnv"><span class="hs-identifier hs-var">emptyDmdEnv</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#topDiv"><span class="hs-identifier hs-var">topDiv</span></a></span><span>
</span><span id="line-1242"></span><span>
</span><span id="line-1243"></span><span class="annot"><a href="GHC.Types.Demand.html#isTopDmdType"><span class="hs-identifier hs-type">isTopDmdType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1244"></span><span id="isTopDmdType"><span class="annot"><span class="annottext">isTopDmdType :: DmdType -&gt; Bool
</span><a href="GHC.Types.Demand.html#isTopDmdType"><span class="hs-identifier hs-var hs-var">isTopDmdType</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810118"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810118"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680810117"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810117"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621680810116"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810116"><span class="hs-identifier hs-var">div</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1245"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810116"><span class="hs-identifier hs-var">div</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; Divergence -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#topDiv"><span class="hs-identifier hs-var">topDiv</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810117"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; Bool
forall a. VarEnv a -&gt; Bool
</span><a href="GHC.Types.Var.Env.html#isEmptyVarEnv"><span class="hs-identifier hs-var">isEmptyVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810118"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-1246"></span><span>
</span><span id="line-1247"></span><span class="hs-comment">-- | The demand type of an unspecified expression that is guaranteed to</span><span>
</span><span id="line-1248"></span><span class="hs-comment">-- throw a (precise or imprecise) exception or diverge.</span><span>
</span><span id="line-1249"></span><span class="annot"><a href="GHC.Types.Demand.html#exnDmdType"><span class="hs-identifier hs-type">exnDmdType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1250"></span><span id="exnDmdType"><span class="annot"><span class="annottext">exnDmdType :: DmdType
</span><a href="GHC.Types.Demand.html#exnDmdType"><span class="hs-identifier hs-var hs-var">exnDmdType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="GHC.Types.Demand.html#emptyDmdEnv"><span class="hs-identifier hs-var">emptyDmdEnv</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#exnDiv"><span class="hs-identifier hs-var">exnDiv</span></a></span><span>
</span><span id="line-1251"></span><span>
</span><span id="line-1252"></span><span class="annot"><a href="GHC.Types.Demand.html#dmdTypeDepth"><span class="hs-identifier hs-type">dmdTypeDepth</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span>
</span><span id="line-1253"></span><span id="dmdTypeDepth"><span class="annot"><span class="annottext">dmdTypeDepth :: DmdType -&gt; Int
</span><a href="GHC.Types.Demand.html#dmdTypeDepth"><span class="hs-identifier hs-var hs-var">dmdTypeDepth</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810113"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810113"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810113"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-1254"></span><span>
</span><span id="line-1255"></span><span class="hs-comment">-- | This makes sure we can use the demand type with n arguments after eta</span><span>
</span><span id="line-1256"></span><span class="hs-comment">-- expansion, where n must not be lower than the demand types depth.</span><span>
</span><span id="line-1257"></span><span class="hs-comment">-- It appends the argument list with the correct 'defaultArgDmd'.</span><span>
</span><span id="line-1258"></span><span class="annot"><a href="GHC.Types.Demand.html#etaExpandDmdType"><span class="hs-identifier hs-type">etaExpandDmdType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1259"></span><span id="etaExpandDmdType"><span class="annot"><span class="annottext">etaExpandDmdType :: Int -&gt; DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#etaExpandDmdType"><span class="hs-identifier hs-var hs-var">etaExpandDmdType</span></a></span></span><span> </span><span id="local-6989586621680810112"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810112"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span id="local-6989586621680810111"><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810111"><span class="hs-identifier hs-var">d</span></a></span></span><span>
</span><span id="line-1260"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810112"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810110"><span class="hs-identifier hs-var">depth</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810111"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-1261"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810112"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&gt;</span></span><span>  </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810110"><span class="hs-identifier hs-var">depth</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810108"><span class="hs-identifier hs-var">fv</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810107"><span class="hs-identifier hs-var">inc_ds</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810106"><span class="hs-identifier hs-var">div</span></a></span><span>
</span><span id="line-1262"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; DmdType
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;etaExpandDmdType: arity decrease&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810112"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810111"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1263"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680810110"><span class="annot"><span class="annottext">depth :: Int
</span><a href="#local-6989586621680810110"><span class="hs-identifier hs-var hs-var">depth</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; Int
</span><a href="GHC.Types.Demand.html#dmdTypeDepth"><span class="hs-identifier hs-var">dmdTypeDepth</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810111"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-1264"></span><span>        </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810108"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810108"><span class="hs-identifier hs-var">fv</span></a></span></span><span> </span><span id="local-6989586621680810104"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810104"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span id="local-6989586621680810106"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810106"><span class="hs-identifier hs-var">div</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810111"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-1265"></span><span>        </span><span class="hs-comment">-- Arity increase:</span><span>
</span><span id="line-1266"></span><span>        </span><span class="hs-comment">--  * Demands on FVs are still valid</span><span>
</span><span id="line-1267"></span><span>        </span><span class="hs-comment">--  * Demands on args also valid, plus we can extend with defaultArgDmd</span><span>
</span><span id="line-1268"></span><span>        </span><span class="hs-comment">--    as appropriate for the given Divergence</span><span>
</span><span id="line-1269"></span><span>        </span><span class="hs-comment">--  * Divergence is still valid:</span><span>
</span><span id="line-1270"></span><span>        </span><span class="hs-comment">--    - A dead end after 2 arguments stays a dead end after 3 arguments</span><span>
</span><span id="line-1271"></span><span>        </span><span class="hs-comment">--    - The remaining case is Dunno, which is already topDiv</span><span>
</span><span id="line-1272"></span><span>        </span><span id="local-6989586621680810107"><span class="annot"><span class="annottext">inc_ds :: [Demand]
</span><a href="#local-6989586621680810107"><span class="hs-identifier hs-var hs-var">inc_ds</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; [Demand] -&gt; [Demand]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810112"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810104"><span class="hs-identifier hs-var">ds</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; [Demand] -&gt; [Demand]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; [Demand]
forall a. a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#repeat"><span class="hs-identifier hs-var">repeat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Divergence -&gt; Demand
</span><a href="GHC.Types.Demand.html#defaultArgDmd"><span class="hs-identifier hs-var">defaultArgDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810106"><span class="hs-identifier hs-var">div</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1273"></span><span>
</span><span id="line-1274"></span><span class="hs-comment">-- | A conservative approximation for a given 'DmdType' in case of an arity</span><span>
</span><span id="line-1275"></span><span class="hs-comment">-- decrease. Currently, it's just nopDmdType.</span><span>
</span><span id="line-1276"></span><span class="annot"><a href="GHC.Types.Demand.html#decreaseArityDmdType"><span class="hs-identifier hs-type">decreaseArityDmdType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1277"></span><span id="decreaseArityDmdType"><span class="annot"><span class="annottext">decreaseArityDmdType :: DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#decreaseArityDmdType"><span class="hs-identifier hs-var hs-var">decreaseArityDmdType</span></a></span></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="GHC.Types.Demand.html#nopDmdType"><span class="hs-identifier hs-var">nopDmdType</span></a></span><span>
</span><span id="line-1278"></span><span>
</span><span id="line-1279"></span><span class="annot"><a href="GHC.Types.Demand.html#seqDmdType"><span class="hs-identifier hs-type">seqDmdType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1280"></span><span id="seqDmdType"><span class="annot"><span class="annottext">seqDmdType :: DmdType -&gt; ()
</span><a href="GHC.Types.Demand.html#seqDmdType"><span class="hs-identifier hs-var hs-var">seqDmdType</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810100"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810100"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680810099"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810099"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span id="local-6989586621680810098"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810098"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-1281"></span><span>  </span><span class="annot"><span class="annottext">DmdEnv -&gt; ()
</span><a href="GHC.Types.Demand.html#seqDmdEnv"><span class="hs-identifier hs-var">seqDmdEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810100"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; ()
</span><a href="GHC.Types.Demand.html#seqDemandList"><span class="hs-identifier hs-var">seqDemandList</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810099"><span class="hs-identifier hs-var">ds</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810098"><span class="hs-identifier hs-var">res</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; () -&gt; ()
</span><span class="hs-operator hs-var">`seq`</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1282"></span><span>
</span><span id="line-1283"></span><span class="annot"><a href="GHC.Types.Demand.html#seqDmdEnv"><span class="hs-identifier hs-type">seqDmdEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1284"></span><span id="seqDmdEnv"><span class="annot"><span class="annottext">seqDmdEnv :: DmdEnv -&gt; ()
</span><a href="GHC.Types.Demand.html#seqDmdEnv"><span class="hs-identifier hs-var hs-var">seqDmdEnv</span></a></span></span><span> </span><span id="local-6989586621680810096"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810096"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">([Demand] -&gt; ()) -&gt; DmdEnv -&gt; ()
forall elt key. ([elt] -&gt; ()) -&gt; UniqFM key elt -&gt; ()
</span><a href="GHC.Types.Unique.FM.html#seqEltsUFM"><span class="hs-identifier hs-var">seqEltsUFM</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; ()
</span><a href="GHC.Types.Demand.html#seqDemandList"><span class="hs-identifier hs-var">seqDemandList</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810096"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-1285"></span><span>
</span><span id="line-1286"></span><span class="annot"><a href="GHC.Types.Demand.html#splitDmdTy"><span class="hs-identifier hs-type">splitDmdTy</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1287"></span><span class="hs-comment">-- Split off one function argument</span><span>
</span><span id="line-1288"></span><span class="hs-comment">-- We already have a suitable demand on all</span><span>
</span><span id="line-1289"></span><span class="hs-comment">-- free vars, so no need to add more!</span><span>
</span><span id="line-1290"></span><span id="splitDmdTy"><span class="annot"><span class="annottext">splitDmdTy :: DmdType -&gt; (Demand, DmdType)
</span><a href="GHC.Types.Demand.html#splitDmdTy"><span class="hs-identifier hs-var hs-var">splitDmdTy</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810094"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810094"><span class="hs-identifier hs-var">fv</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680810093"><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680810093"><span class="hs-identifier hs-var">dmd</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680810092"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810092"><span class="hs-identifier hs-var">dmds</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680810091"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810091"><span class="hs-identifier hs-var">res_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680810093"><span class="hs-identifier hs-var">dmd</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810094"><span class="hs-identifier hs-var">fv</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810092"><span class="hs-identifier hs-var">dmds</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810091"><span class="hs-identifier hs-var">res_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1291"></span><span class="annot"><a href="GHC.Types.Demand.html#splitDmdTy"><span class="hs-identifier hs-var">splitDmdTy</span></a></span><span> </span><span id="local-6989586621680810090"><span class="annot"><span class="annottext">ty :: DmdType
</span><a href="#local-6989586621680810090"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621680810089"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810089"><span class="hs-identifier hs-var">res_ty</span></a></span></span><span class="hs-special">)</span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Divergence -&gt; Demand
</span><a href="GHC.Types.Demand.html#defaultArgDmd"><span class="hs-identifier hs-var">defaultArgDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810089"><span class="hs-identifier hs-var">res_ty</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810090"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1292"></span><span>
</span><span id="line-1293"></span><span class="hs-comment">-- | When e is evaluated after executing an IO action that may throw a precise</span><span>
</span><span id="line-1294"></span><span class="hs-comment">-- exception, we act as if there is an additional control flow path that is</span><span>
</span><span id="line-1295"></span><span class="hs-comment">-- taken if e throws a precise exception. The demand type of this control flow</span><span>
</span><span id="line-1296"></span><span class="hs-comment">-- path</span><span>
</span><span id="line-1297"></span><span class="hs-comment">--   * is lazy and absent ('topDmd') in all free variables and arguments</span><span>
</span><span id="line-1298"></span><span class="hs-comment">--   * has 'exnDiv' 'Divergence' result</span><span>
</span><span id="line-1299"></span><span class="hs-comment">-- So we can simply take a variant of 'nopDmdType', 'exnDmdType'.</span><span>
</span><span id="line-1300"></span><span class="hs-comment">-- Why not 'nopDmdType'? Because then the result of 'e' can never be 'exnDiv'!</span><span>
</span><span id="line-1301"></span><span class="hs-comment">-- That means failure to drop dead-ends, see #18086.</span><span>
</span><span id="line-1302"></span><span class="hs-comment">-- See Note [Precise exceptions and strictness analysis]</span><span>
</span><span id="line-1303"></span><span class="annot"><a href="GHC.Types.Demand.html#deferAfterPreciseException"><span class="hs-identifier hs-type">deferAfterPreciseException</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1304"></span><span id="deferAfterPreciseException"><span class="annot"><span class="annottext">deferAfterPreciseException :: DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#deferAfterPreciseException"><span class="hs-identifier hs-var hs-var">deferAfterPreciseException</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#lubDmdType"><span class="hs-identifier hs-var">lubDmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="GHC.Types.Demand.html#exnDmdType"><span class="hs-identifier hs-var">exnDmdType</span></a></span><span>
</span><span id="line-1305"></span><span>
</span><span id="line-1306"></span><span class="annot"><a href="GHC.Types.Demand.html#strictenDmd"><span class="hs-identifier hs-type">strictenDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-1307"></span><span id="strictenDmd"><span class="annot"><span class="annottext">strictenDmd :: Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#strictenDmd"><span class="hs-identifier hs-var hs-var">strictenDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810088"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810088"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810087"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810087"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1308"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; ArgStr
</span><a href="#local-6989586621680810086"><span class="hs-identifier hs-var">poke_s</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810088"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; ArgUse
</span><a href="#local-6989586621680810085"><span class="hs-identifier hs-var">poke_u</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810087"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1309"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1310"></span><span>    </span><span id="local-6989586621680810086"><span class="annot"><span class="annottext">poke_s :: ArgStr -&gt; ArgStr
</span><a href="#local-6989586621680810086"><span class="hs-identifier hs-var hs-var">poke_s</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>
</span><span id="line-1311"></span><span>    </span><span class="annot"><a href="#local-6989586621680810086"><span class="hs-identifier hs-var">poke_s</span></a></span><span> </span><span id="local-6989586621680810084"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810084"><span class="hs-identifier hs-var">s</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810084"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1312"></span><span>    </span><span id="local-6989586621680810085"><span class="annot"><span class="annottext">poke_u :: ArgUse -&gt; ArgUse
</span><a href="#local-6989586621680810085"><span class="hs-identifier hs-var hs-var">poke_u</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#useTop"><span class="hs-identifier hs-var">useTop</span></a></span><span>
</span><span id="line-1313"></span><span>    </span><span class="annot"><a href="#local-6989586621680810085"><span class="hs-identifier hs-var">poke_u</span></a></span><span> </span><span id="local-6989586621680810083"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810083"><span class="hs-identifier hs-var">u</span></a></span></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810083"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-1314"></span><span>
</span><span id="line-1315"></span><span class="hs-comment">-- Deferring and peeling</span><span>
</span><span id="line-1316"></span><span>
</span><span id="line-1317"></span><span class="hs-keyword">type</span><span> </span><span id="DmdShell"><span class="annot"><a href="GHC.Types.Demand.html#DmdShell"><span class="hs-identifier hs-var">DmdShell</span></a></span></span><span>   </span><span class="hs-comment">-- Describes the &quot;outer shell&quot;</span><span>
</span><span id="line-1318"></span><span>                </span><span class="hs-comment">-- of a Demand</span><span>
</span><span id="line-1319"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1320"></span><span>
</span><span id="line-1321"></span><span class="annot"><a href="GHC.Types.Demand.html#toCleanDmd"><span class="hs-identifier hs-type">toCleanDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdShell"><span class="hs-identifier hs-type">DmdShell</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1322"></span><span class="hs-comment">-- Splits a Demand into its &quot;shell&quot; and the inner &quot;clean demand&quot;</span><span>
</span><span id="line-1323"></span><span id="toCleanDmd"><span class="annot"><span class="annottext">toCleanDmd :: Demand -&gt; (DmdShell, CleanDemand)
</span><a href="GHC.Types.Demand.html#toCleanDmd"><span class="hs-identifier hs-var hs-var">toCleanDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810082"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810082"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810081"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810081"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1324"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: Str ()
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Str ()
</span><a href="#local-6989586621680810080"><span class="hs-identifier hs-var">ss</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: Use ()
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Use ()
</span><a href="#local-6989586621680810079"><span class="hs-identifier hs-var">us</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: StrDmd
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810078"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: UseDmd
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810077"><span class="hs-identifier hs-var">u'</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1325"></span><span>    </span><span class="hs-comment">-- See Note [Analyzing with lazy demand and lambdas]</span><span>
</span><span id="line-1326"></span><span>    </span><span class="hs-comment">-- See Note [Analysing with absent demand]</span><span>
</span><span id="line-1327"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1328"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680810080"><span class="annot"><span class="annottext">Str ()
</span><a href="#local-6989586621680810080"><span class="hs-identifier hs-var">ss</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810078"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810078"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810082"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1329"></span><span>                </span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span id="local-6989586621680810076"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810076"><span class="hs-identifier hs-var">s'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">() -&gt; Str ()
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810076"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1330"></span><span>                </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Str ()
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span class="hs-special">,</span><span>   </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1331"></span><span>
</span><span id="line-1332"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680810079"><span class="annot"><span class="annottext">Use ()
</span><a href="#local-6989586621680810079"><span class="hs-identifier hs-var">us</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810077"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810077"><span class="hs-identifier hs-var">u'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810081"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1333"></span><span>                 </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span id="local-6989586621680810075"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810075"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680810074"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810074"><span class="hs-identifier hs-var">u'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Count -&gt; () -&gt; Use ()
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810075"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810074"><span class="hs-identifier hs-var">u'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1334"></span><span>                 </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Use ()
forall u. Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span class="hs-special">,</span><span>      </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1335"></span><span>
</span><span id="line-1336"></span><span class="hs-comment">-- This is used in dmdAnalStar when post-processing</span><span>
</span><span id="line-1337"></span><span class="hs-comment">-- a function's argument demand. So we only care about what</span><span>
</span><span id="line-1338"></span><span class="hs-comment">-- does to free variables, and whether it terminates.</span><span>
</span><span id="line-1339"></span><span class="hs-comment">-- see Note [Asymmetry of 'both*']</span><span>
</span><span id="line-1340"></span><span class="annot"><a href="GHC.Types.Demand.html#postProcessDmdType"><span class="hs-identifier hs-type">postProcessDmdType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdShell"><span class="hs-identifier hs-type">DmdShell</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#BothDmdArg"><span class="hs-identifier hs-type">BothDmdArg</span></a></span><span>
</span><span id="line-1341"></span><span id="postProcessDmdType"><span class="annot"><span class="annottext">postProcessDmdType :: DmdShell -&gt; DmdType -&gt; BothDmdArg
</span><a href="GHC.Types.Demand.html#postProcessDmdType"><span class="hs-identifier hs-var hs-var">postProcessDmdType</span></a></span></span><span> </span><span id="local-6989586621680810073"><span class="annot"><span class="annottext">du :: DmdShell
</span><a href="#local-6989586621680810073"><span class="hs-identifier hs-var">du</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810072"><span class="annot"><span class="annottext">Str ()
</span><a href="#local-6989586621680810072"><span class="hs-identifier hs-var">ss</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810071"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810071"><span class="hs-identifier hs-var">fv</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810070"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810070"><span class="hs-identifier hs-var">res_ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1342"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdShell -&gt; DmdEnv -&gt; DmdEnv
</span><a href="GHC.Types.Demand.html#postProcessDmdEnv"><span class="hs-identifier hs-var">postProcessDmdEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621680810073"><span class="hs-identifier hs-var">du</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810071"><span class="hs-identifier hs-var">fv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Str () -&gt; Divergence -&gt; Divergence
</span><a href="GHC.Types.Demand.html#postProcessDivergence"><span class="hs-identifier hs-var">postProcessDivergence</span></a></span><span> </span><span class="annot"><span class="annottext">Str ()
</span><a href="#local-6989586621680810072"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810070"><span class="hs-identifier hs-var">res_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1343"></span><span>
</span><span id="line-1344"></span><span class="annot"><a href="GHC.Types.Demand.html#postProcessDivergence"><span class="hs-identifier hs-type">postProcessDivergence</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span>
</span><span id="line-1345"></span><span class="hs-comment">-- In a Lazy scenario, we might not force the Divergence, in which case we</span><span>
</span><span id="line-1346"></span><span class="hs-comment">-- converge, hence Dunno.</span><span>
</span><span id="line-1347"></span><span id="postProcessDivergence"><span class="annot"><span class="annottext">postProcessDivergence :: Str () -&gt; Divergence -&gt; Divergence
</span><a href="GHC.Types.Demand.html#postProcessDivergence"><span class="hs-identifier hs-var hs-var">postProcessDivergence</span></a></span></span><span> </span><span class="annot"><span class="annottext">Str ()
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span><span>
</span><span id="line-1348"></span><span class="annot"><a href="GHC.Types.Demand.html#postProcessDivergence"><span class="hs-identifier hs-var">postProcessDivergence</span></a></span><span> </span><span class="annot"><span class="annottext">Str ()
</span><span class="hs-identifier">_</span></span><span>    </span><span id="local-6989586621680810067"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810067"><span class="hs-identifier hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810067"><span class="hs-identifier hs-var">d</span></a></span><span>
</span><span id="line-1349"></span><span>
</span><span id="line-1350"></span><span class="annot"><a href="GHC.Types.Demand.html#postProcessDmdEnv"><span class="hs-identifier hs-type">postProcessDmdEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdShell"><span class="hs-identifier hs-type">DmdShell</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span>
</span><span id="line-1351"></span><span id="postProcessDmdEnv"><span class="annot"><span class="annottext">postProcessDmdEnv :: DmdShell -&gt; DmdEnv -&gt; DmdEnv
</span><a href="GHC.Types.Demand.html#postProcessDmdEnv"><span class="hs-identifier hs-var hs-var">postProcessDmdEnv</span></a></span></span><span> </span><span id="local-6989586621680810066"><span class="annot"><span class="annottext">ds :: DmdShell
</span><a href="#local-6989586621680810066"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810065"><span class="annot"><span class="annottext">Str ()
</span><a href="#local-6989586621680810065"><span class="hs-identifier hs-var">ss</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810064"><span class="annot"><span class="annottext">Use ()
</span><a href="#local-6989586621680810064"><span class="hs-identifier hs-var">us</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680810063"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810063"><span class="hs-identifier hs-var">env</span></a></span></span><span>
</span><span id="line-1352"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Use ()
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Use ()
</span><a href="#local-6989586621680810064"><span class="hs-identifier hs-var">us</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="GHC.Types.Demand.html#emptyDmdEnv"><span class="hs-identifier hs-var">emptyDmdEnv</span></a></span><span>
</span><span id="line-1353"></span><span>    </span><span class="hs-comment">-- In this case (postProcessDmd ds) == id; avoid a redundant rebuild</span><span>
</span><span id="line-1354"></span><span>    </span><span class="hs-comment">-- of the environment. Be careful, bad things will happen if this doesn't</span><span>
</span><span id="line-1355"></span><span>    </span><span class="hs-comment">-- match postProcessDmd (see #13977).</span><span>
</span><span id="line-1356"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="annot"><span class="annottext">()
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Str ()
</span><a href="#local-6989586621680810065"><span class="hs-identifier hs-var">ss</span></a></span><span>
</span><span id="line-1357"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="annot"><span class="annottext">()
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Use ()
</span><a href="#local-6989586621680810064"><span class="hs-identifier hs-var">us</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810063"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-1358"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Demand -&gt; Demand) -&gt; DmdEnv -&gt; DmdEnv
forall a b. (a -&gt; b) -&gt; VarEnv a -&gt; VarEnv b
</span><a href="GHC.Types.Var.Env.html#mapVarEnv"><span class="hs-identifier hs-var">mapVarEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdShell -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#postProcessDmd"><span class="hs-identifier hs-var">postProcessDmd</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621680810066"><span class="hs-identifier hs-var">ds</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810063"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-1359"></span><span>  </span><span class="hs-comment">-- For the Absent case just discard all usage information</span><span>
</span><span id="line-1360"></span><span>  </span><span class="hs-comment">-- We only processed the thing at all to analyse the body</span><span>
</span><span id="line-1361"></span><span>  </span><span class="hs-comment">-- See Note [Always analyse in virgin pass]</span><span>
</span><span id="line-1362"></span><span>
</span><span id="line-1363"></span><span class="annot"><a href="GHC.Types.Demand.html#reuseEnv"><span class="hs-identifier hs-type">reuseEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span>
</span><span id="line-1364"></span><span id="reuseEnv"><span class="annot"><span class="annottext">reuseEnv :: DmdEnv -&gt; DmdEnv
</span><a href="GHC.Types.Demand.html#reuseEnv"><span class="hs-identifier hs-var hs-var">reuseEnv</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Demand -&gt; Demand) -&gt; DmdEnv -&gt; DmdEnv
forall a b. (a -&gt; b) -&gt; VarEnv a -&gt; VarEnv b
</span><a href="GHC.Types.Var.Env.html#mapVarEnv"><span class="hs-identifier hs-var">mapVarEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdShell -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#postProcessDmd"><span class="hs-identifier hs-var">postProcessDmd</span></a></span><span>
</span><span id="line-1365"></span><span>                        </span><span class="hs-special">(</span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: Str ()
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; Str ()
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: Use ()
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; () -&gt; Use ()
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1366"></span><span>
</span><span id="line-1367"></span><span class="annot"><a href="GHC.Types.Demand.html#postProcessUnsat"><span class="hs-identifier hs-type">postProcessUnsat</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdShell"><span class="hs-identifier hs-type">DmdShell</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1368"></span><span id="postProcessUnsat"><span class="annot"><span class="annottext">postProcessUnsat :: DmdShell -&gt; DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#postProcessUnsat"><span class="hs-identifier hs-var hs-var">postProcessUnsat</span></a></span></span><span> </span><span id="local-6989586621680810060"><span class="annot"><span class="annottext">ds :: DmdShell
</span><a href="#local-6989586621680810060"><span class="hs-identifier hs-var">ds</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810059"><span class="annot"><span class="annottext">Str ()
</span><a href="#local-6989586621680810059"><span class="hs-identifier hs-var">ss</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810058"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810058"><span class="hs-identifier hs-var">fv</span></a></span></span><span> </span><span id="local-6989586621680810057"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810057"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621680810056"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810056"><span class="hs-identifier hs-var">res_ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1369"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdShell -&gt; DmdEnv -&gt; DmdEnv
</span><a href="GHC.Types.Demand.html#postProcessDmdEnv"><span class="hs-identifier hs-var">postProcessDmdEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621680810060"><span class="hs-identifier hs-var">ds</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810058"><span class="hs-identifier hs-var">fv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1370"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Demand -&gt; Demand) -&gt; [Demand] -&gt; [Demand]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdShell -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#postProcessDmd"><span class="hs-identifier hs-var">postProcessDmd</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621680810060"><span class="hs-identifier hs-var">ds</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810057"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1371"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Str () -&gt; Divergence -&gt; Divergence
</span><a href="GHC.Types.Demand.html#postProcessDivergence"><span class="hs-identifier hs-var">postProcessDivergence</span></a></span><span> </span><span class="annot"><span class="annottext">Str ()
</span><a href="#local-6989586621680810059"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810056"><span class="hs-identifier hs-var">res_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1372"></span><span>
</span><span id="line-1373"></span><span class="annot"><a href="GHC.Types.Demand.html#postProcessDmd"><span class="hs-identifier hs-type">postProcessDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdShell"><span class="hs-identifier hs-type">DmdShell</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-1374"></span><span id="postProcessDmd"><span class="annot"><span class="annottext">postProcessDmd :: DmdShell -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#postProcessDmd"><span class="hs-identifier hs-var hs-var">postProcessDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810055"><span class="annot"><span class="annottext">Str ()
</span><a href="#local-6989586621680810055"><span class="hs-identifier hs-var">ss</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810054"><span class="annot"><span class="annottext">Use ()
</span><a href="#local-6989586621680810054"><span class="hs-identifier hs-var">us</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810053"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810053"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810052"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810052"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1375"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810051"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810050"><span class="hs-identifier hs-var">a'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1376"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1377"></span><span>    </span><span id="local-6989586621680810051"><span class="annot"><span class="annottext">s' :: ArgStr
</span><a href="#local-6989586621680810051"><span class="hs-identifier hs-var hs-var">s'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Str ()
</span><a href="#local-6989586621680810055"><span class="hs-identifier hs-var">ss</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1378"></span><span>           </span><span class="annot"><span class="annottext">Str ()
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>
</span><span id="line-1379"></span><span>           </span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="annot"><span class="annottext">()
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680810053"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1380"></span><span>    </span><span id="local-6989586621680810050"><span class="annot"><span class="annottext">a' :: ArgUse
</span><a href="#local-6989586621680810050"><span class="hs-identifier hs-var hs-var">a'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Use ()
</span><a href="#local-6989586621680810054"><span class="hs-identifier hs-var">us</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1381"></span><span>           </span><span class="annot"><span class="annottext">Use ()
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ArgUse
forall u. Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>
</span><span id="line-1382"></span><span>           </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">()
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#markReusedDmd"><span class="hs-identifier hs-var">markReusedDmd</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810052"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-1383"></span><span>           </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span>  </span><span class="annot"><span class="annottext">()
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680810052"><span class="hs-identifier hs-var">a</span></a></span><span>
</span><span id="line-1384"></span><span>
</span><span id="line-1385"></span><span class="hs-comment">-- Peels one call level from the demand, and also returns</span><span>
</span><span id="line-1386"></span><span class="hs-comment">-- whether it was unsaturated (separately for strictness and usage)</span><span>
</span><span id="line-1387"></span><span class="annot"><a href="GHC.Types.Demand.html#peelCallDmd"><span class="hs-identifier hs-type">peelCallDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdShell"><span class="hs-identifier hs-type">DmdShell</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1388"></span><span class="hs-comment">-- Exploiting the fact that</span><span>
</span><span id="line-1389"></span><span class="hs-comment">-- on the strictness side      C(B) = B</span><span>
</span><span id="line-1390"></span><span class="hs-comment">-- and on the usage side       C(U) = U</span><span>
</span><span id="line-1391"></span><span id="peelCallDmd"><span class="annot"><span class="annottext">peelCallDmd :: CleanDemand -&gt; (CleanDemand, DmdShell)
</span><a href="GHC.Types.Demand.html#peelCallDmd"><span class="hs-identifier hs-var hs-var">peelCallDmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810049"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810049"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810048"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810048"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1392"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: StrDmd
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810047"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: UseDmd
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810046"><span class="hs-identifier hs-var">u'</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: Str ()
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Str ()
</span><a href="#local-6989586621680810045"><span class="hs-identifier hs-var">ss</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: Use ()
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Use ()
</span><a href="#local-6989586621680810044"><span class="hs-identifier hs-var">us</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1393"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1394"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680810047"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810047"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810045"><span class="annot"><span class="annottext">Str ()
</span><a href="#local-6989586621680810045"><span class="hs-identifier hs-var">ss</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810049"><span class="hs-identifier hs-var">s</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1395"></span><span>                 </span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680810043"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810043"><span class="hs-identifier hs-var">s'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810043"><span class="hs-identifier hs-var">s'</span></a></span><span class="hs-special">,</span><span>       </span><span class="annot"><span class="annottext">() -&gt; Str ()
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1396"></span><span>                 </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">() -&gt; Str ()
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1397"></span><span>                 </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span class="hs-special">,</span><span>  </span><span class="annot"><span class="annottext">Str ()
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1398"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621680810046"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810046"><span class="hs-identifier hs-var">u'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680810044"><span class="annot"><span class="annottext">Use ()
</span><a href="#local-6989586621680810044"><span class="hs-identifier hs-var">us</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810048"><span class="hs-identifier hs-var">u</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1399"></span><span>                 </span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span id="local-6989586621680810042"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810042"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680810041"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810041"><span class="hs-identifier hs-var">u'</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810041"><span class="hs-identifier hs-var">u'</span></a></span><span class="hs-special">,</span><span>   </span><span class="annot"><span class="annottext">Count -&gt; () -&gt; Use ()
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680810042"><span class="hs-identifier hs-var">c</span></a></span><span>    </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1400"></span><span>                 </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Count -&gt; () -&gt; Use ()
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1401"></span><span>       </span><span class="hs-comment">-- The _ cases for usage includes UHead which seems a bit wrong</span><span>
</span><span id="line-1402"></span><span>       </span><span class="hs-comment">-- because the body isn't used at all!</span><span>
</span><span id="line-1403"></span><span>       </span><span class="hs-comment">-- c.f. the Abs case in toCleanDmd</span><span>
</span><span id="line-1404"></span><span>
</span><span id="line-1405"></span><span class="hs-comment">-- Peels that multiple nestings of calls clean demand and also returns</span><span>
</span><span id="line-1406"></span><span class="hs-comment">-- whether it was unsaturated (separately for strictness and usage</span><span>
</span><span id="line-1407"></span><span class="hs-comment">-- see Note [Demands from unsaturated function calls]</span><span>
</span><span id="line-1408"></span><span class="annot"><a href="GHC.Types.Demand.html#peelManyCalls"><span class="hs-identifier hs-type">peelManyCalls</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdShell"><span class="hs-identifier hs-type">DmdShell</span></a></span><span>
</span><span id="line-1409"></span><span id="peelManyCalls"><span class="annot"><span class="annottext">peelManyCalls :: Int -&gt; CleanDemand -&gt; DmdShell
</span><a href="GHC.Types.Demand.html#peelManyCalls"><span class="hs-identifier hs-var hs-var">peelManyCalls</span></a></span></span><span> </span><span id="local-6989586621680810040"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810040"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810039"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810039"><span class="hs-identifier hs-var">str</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680810038"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810038"><span class="hs-identifier hs-var">abs</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1410"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: Str ()
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; StrDmd -&gt; Str ()
</span><a href="#local-6989586621680810037"><span class="hs-identifier hs-var">go_str</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810040"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810039"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: Use ()
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; UseDmd -&gt; Use ()
</span><a href="#local-6989586621680810036"><span class="hs-identifier hs-var">go_abs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810040"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810038"><span class="hs-identifier hs-var">abs</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1411"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1412"></span><span>    </span><span class="annot"><a href="#local-6989586621680810037"><span class="hs-identifier hs-type">go_str</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>  </span><span class="hs-comment">-- True &lt;=&gt; unsaturated, defer</span><span>
</span><span id="line-1413"></span><span>    </span><span id="local-6989586621680810037"><span class="annot"><span class="annottext">go_str :: Int -&gt; StrDmd -&gt; Str ()
</span><a href="#local-6989586621680810037"><span class="hs-identifier hs-var hs-var">go_str</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; Str ()
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1414"></span><span>    </span><span class="annot"><a href="#local-6989586621680810037"><span class="hs-identifier hs-var">go_str</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; Str ()
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- == go_str (n-1) HyperStr, as HyperStr = Call(HyperStr)</span><span>
</span><span id="line-1415"></span><span>    </span><span class="annot"><a href="#local-6989586621680810037"><span class="hs-identifier hs-var">go_str</span></a></span><span> </span><span id="local-6989586621680810035"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810035"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680810034"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810034"><span class="hs-identifier hs-var">d'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; StrDmd -&gt; Str ()
</span><a href="#local-6989586621680810037"><span class="hs-identifier hs-var">go_str</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810035"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680810034"><span class="hs-identifier hs-var">d'</span></a></span><span>
</span><span id="line-1416"></span><span>    </span><span class="annot"><a href="#local-6989586621680810037"><span class="hs-identifier hs-var">go_str</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Str ()
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>
</span><span id="line-1417"></span><span>
</span><span id="line-1418"></span><span>    </span><span class="annot"><a href="#local-6989586621680810036"><span class="hs-identifier hs-type">go_abs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>      </span><span class="hs-comment">-- Many &lt;=&gt; unsaturated, or at least</span><span>
</span><span id="line-1419"></span><span>    </span><span id="local-6989586621680810036"><span class="annot"><span class="annottext">go_abs :: Int -&gt; UseDmd -&gt; Use ()
</span><a href="#local-6989586621680810036"><span class="hs-identifier hs-var hs-var">go_abs</span></a></span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; () -&gt; Use ()
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>   </span><span class="hs-comment">--          one UCall Many in the demand</span><span>
</span><span id="line-1420"></span><span>    </span><span class="annot"><a href="#local-6989586621680810036"><span class="hs-identifier hs-var">go_abs</span></a></span><span> </span><span id="local-6989586621680810033"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810033"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span id="local-6989586621680810032"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810032"><span class="hs-identifier hs-var">d'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; UseDmd -&gt; Use ()
</span><a href="#local-6989586621680810036"><span class="hs-identifier hs-var">go_abs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680810033"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680810032"><span class="hs-identifier hs-var">d'</span></a></span><span>
</span><span id="line-1421"></span><span>    </span><span class="annot"><a href="#local-6989586621680810036"><span class="hs-identifier hs-var">go_abs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; () -&gt; Use ()
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1422"></span><span>
</span><span id="line-1423"></span><span class="hs-comment">{-
Note [Demands from unsaturated function calls]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider a demand transformer d1 -&gt; d2 -&gt; r for f.
If a sufficiently detailed demand is fed into this transformer,
e.g &lt;C(C(S)), C1(C1(S))&gt; arising from &quot;f x1 x2&quot; in a strict, use-once context,
then d1 and d2 is precisely the demand unleashed onto x1 and x2 (similar for
the free variable environment) and furthermore the result information r is the
one we want to use.

An anonymous lambda is also an unsaturated function all (needs one argument,
none given), so this applies to that case as well.

But the demand fed into f might be less than &lt;C(C(S)), C1(C1(S))&gt;. There are a few cases:
 * Not enough demand on the strictness side:
   - In that case, we need to zap all strictness in the demand on arguments and
     free variables.
   - And finally Divergence information: If r says that f Diverges for sure,
     then this holds when the demand guarantees that two arguments are going to
     be passed. If the demand is lower, we may just as well converge.
     If we were tracking definite convegence, than that would still hold under
     a weaker demand than expected by the demand transformer.
 * Not enough demand from the usage side: The missing usage can be expanded
   using UCall Many, therefore this is subsumed by the third case:
 * At least one of the uses has a cardinality of Many.
   - Even if f puts a One demand on any of its argument or free variables, if
     we call f multiple times, we may evaluate this argument or free variable
     multiple times. So forget about any occurrence of &quot;One&quot; in the demand.

In dmdTransformSig, we call peelManyCalls to find out if we are in any of these
cases, and then call postProcessUnsat to reduce the demand appropriately.

Similarly, dmdTransformDictSelSig and dmdAnal, when analyzing a Lambda, use
peelCallDmd, which peels only one level, but also returns the demand put on the
body of the function.
-}</span><span>
</span><span id="line-1459"></span><span>
</span><span id="line-1460"></span><span class="annot"><a href="GHC.Types.Demand.html#peelFV"><span class="hs-identifier hs-type">peelFV</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1461"></span><span id="peelFV"><span class="annot"><span class="annottext">peelFV :: DmdType -&gt; Var -&gt; (DmdType, Demand)
</span><a href="GHC.Types.Demand.html#peelFV"><span class="hs-identifier hs-var hs-var">peelFV</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810031"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810031"><span class="hs-identifier hs-var">fv</span></a></span></span><span> </span><span id="local-6989586621680810030"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810030"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span id="local-6989586621680810029"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810029"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680810028"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680810028"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- pprTrace &quot;rfv&quot; (ppr id &lt;+&gt; ppr dmd $$ ppr fv)</span><span>
</span><span id="line-1462"></span><span>                               </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810027"><span class="hs-identifier hs-var">fv'</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810030"><span class="hs-identifier hs-var">ds</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810029"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680810026"><span class="hs-identifier hs-var">dmd</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1463"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1464"></span><span>  </span><span id="local-6989586621680810027"><span class="annot"><span class="annottext">fv' :: DmdEnv
</span><a href="#local-6989586621680810027"><span class="hs-identifier hs-var hs-var">fv'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810031"><span class="hs-identifier hs-var">fv</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; Var -&gt; DmdEnv
forall a. VarEnv a -&gt; Var -&gt; VarEnv a
</span><a href="GHC.Types.Var.Env.html#delVarEnv"><span class="hs-operator hs-var">`delVarEnv`</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680810028"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-1465"></span><span>  </span><span class="hs-comment">-- See Note [Default demand on free variables and arguments]</span><span>
</span><span id="line-1466"></span><span>  </span><span id="local-6989586621680810026"><span class="annot"><span class="annottext">dmd :: Demand
</span><a href="#local-6989586621680810026"><span class="hs-identifier hs-var hs-var">dmd</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; Var -&gt; Maybe Demand
forall a. VarEnv a -&gt; Var -&gt; Maybe a
</span><a href="GHC.Types.Var.Env.html#lookupVarEnv"><span class="hs-identifier hs-var">lookupVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810031"><span class="hs-identifier hs-var">fv</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680810028"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Demand -&gt; Demand -&gt; Demand
forall a. Maybe a -&gt; a -&gt; a
</span><a href="GHC.Data.Maybe.html#orElse"><span class="hs-operator hs-var">`orElse`</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; Demand
</span><a href="GHC.Types.Demand.html#defaultFvDmd"><span class="hs-identifier hs-var">defaultFvDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810029"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1467"></span><span>
</span><span id="line-1468"></span><span class="annot"><a href="GHC.Types.Demand.html#addDemand"><span class="hs-identifier hs-type">addDemand</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1469"></span><span id="addDemand"><span class="annot"><span class="annottext">addDemand :: Demand -&gt; DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#addDemand"><span class="hs-identifier hs-var hs-var">addDemand</span></a></span></span><span> </span><span id="local-6989586621680810023"><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680810023"><span class="hs-identifier hs-var">dmd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810022"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810022"><span class="hs-identifier hs-var">fv</span></a></span></span><span> </span><span id="local-6989586621680810021"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810021"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span id="local-6989586621680810020"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810020"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810022"><span class="hs-identifier hs-var">fv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680810023"><span class="hs-identifier hs-var">dmd</span></a></span><span class="annot"><span class="annottext">Demand -&gt; [Demand] -&gt; [Demand]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810021"><span class="hs-identifier hs-var">ds</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810020"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1470"></span><span>
</span><span id="line-1471"></span><span class="annot"><a href="GHC.Types.Demand.html#findIdDemand"><span class="hs-identifier hs-type">findIdDemand</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Var"><span class="hs-identifier hs-type">Var</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-1472"></span><span id="findIdDemand"><span class="annot"><span class="annottext">findIdDemand :: DmdType -&gt; Var -&gt; Demand
</span><a href="GHC.Types.Demand.html#findIdDemand"><span class="hs-identifier hs-var hs-var">findIdDemand</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680810019"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810019"><span class="hs-identifier hs-var">fv</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810018"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810018"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621680810017"><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680810017"><span class="hs-identifier hs-var">id</span></a></span></span><span>
</span><span id="line-1473"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; Var -&gt; Maybe Demand
forall a. VarEnv a -&gt; Var -&gt; Maybe a
</span><a href="GHC.Types.Var.Env.html#lookupVarEnv"><span class="hs-identifier hs-var">lookupVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680810019"><span class="hs-identifier hs-var">fv</span></a></span><span> </span><span class="annot"><span class="annottext">Var
</span><a href="#local-6989586621680810017"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Demand -&gt; Demand -&gt; Demand
forall a. Maybe a -&gt; a -&gt; a
</span><a href="GHC.Data.Maybe.html#orElse"><span class="hs-operator hs-var">`orElse`</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; Demand
</span><a href="GHC.Types.Demand.html#defaultFvDmd"><span class="hs-identifier hs-var">defaultFvDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680810018"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1474"></span><span>
</span><span id="line-1475"></span><span class="hs-comment">{-
Note [Always analyse in virgin pass]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tricky point: make sure that we analyse in the 'virgin' pass. Consider
   rec { f acc x True  = f (...rec { g y = ...g... }...)
         f acc x False = acc }
In the virgin pass for 'f' we'll give 'f' a very strict (bottom) type.
That might mean that we analyse the sub-expression containing the
E = &quot;...rec g...&quot; stuff in a bottom demand.  Suppose we *didn't analyse*
E, but just returned botType.

Then in the *next* (non-virgin) iteration for 'f', we might analyse E
in a weaker demand, and that will trigger doing a fixpoint iteration
for g.  But *because it's not the virgin pass* we won't start g's
iteration at bottom.  Disaster.  (This happened in $sfibToList' of
nofib/spectral/fibheaps.)

So in the virgin pass we make sure that we do analyse the expression
at least once, to initialise its signatures.

Note [Analyzing with lazy demand and lambdas]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The insight for analyzing lambdas follows from the fact that for
strictness S = C(L). This polymorphic expansion is critical for
cardinality analysis of the following example:

{-# NOINLINE build #-}
build g = (g (:) [], g (:) [])

h c z = build (\x -&gt;
                let z1 = z ++ z
                 in if c
                    then \y -&gt; x (y ++ z1)
                    else \y -&gt; x (z1 ++ y))

One can see that `build` assigns to `g` demand &lt;L,C(C1(U))&gt;.
Therefore, when analyzing the lambda `(\x -&gt; ...)`, we
expect each lambda \y -&gt; ... to be annotated as &quot;one-shot&quot;
one. Therefore (\x -&gt; \y -&gt; x (y ++ z)) should be analyzed with a
demand &lt;C(C(..), C(C1(U))&gt;.

This is achieved by, first, converting the lazy demand L into the
strict S by the second clause of the analysis.

Note [Analysing with absent demand]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Suppose we analyse an expression with demand &lt;L,A&gt;.  The &quot;A&quot; means
&quot;absent&quot;, so this expression will never be needed.  What should happen?
There are several wrinkles:

* We *do* want to analyse the expression regardless.
  Reason: Note [Always analyse in virgin pass]

  But we can post-process the results to ignore all the usage
  demands coming back. This is done by postProcessDmdType.

* In a previous incarnation of GHC we needed to be extra careful in the
  case of an *unlifted type*, because unlifted values are evaluated
  even if they are not used.  Example (see #9254):
     f :: (() -&gt; (# Int#, () #)) -&gt; ()
          -- Strictness signature is
          --    &lt;C(S(LS)), 1*C1(U(A,1*U()))&gt;
          -- I.e. calls k, but discards first component of result
     f k = case k () of (# _, r #) -&gt; r

     g :: Int -&gt; ()
     g y = f (\n -&gt; (# case y of I# y2 -&gt; y2, n #))

  Here f's strictness signature says (correctly) that it calls its
  argument function and ignores the first component of its result.
  This is correct in the sense that it'd be fine to (say) modify the
  function so that always returned 0# in the first component.

  But in function g, we *will* evaluate the 'case y of ...', because
  it has type Int#.  So 'y' will be evaluated.  So we must record this
  usage of 'y', else 'g' will say 'y' is absent, and will w/w so that
  'y' is bound to an aBSENT_ERROR thunk.

  However, the argument of toCleanDmd always satisfies the let/app
  invariant; so if it is unlifted it is also okForSpeculation, and so
  can be evaluated in a short finite time -- and that rules out nasty
  cases like the one above.  (I'm not quite sure why this was a
  problem in an earlier version of GHC, but it isn't now.)
-}</span><span>
</span><span id="line-1559"></span><span>
</span><span id="line-1560"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
                     Demand signatures
*                                                                      *
************************************************************************

In a let-bound Id we record its strictness info.
In principle, this strictness info is a demand transformer, mapping
a demand on the Id into a DmdType, which gives
        a) the free vars of the Id's value
        b) the Id's arguments
        c) an indication of the result of applying
           the Id to its arguments

However, in fact we store in the Id an extremely emascuated demand
transfomer, namely

                a single DmdType
(Nevertheless we dignify StrictSig as a distinct type.)

This DmdType gives the demands unleashed by the Id when it is applied
to as many arguments as are given in by the arg demands in the DmdType.
Also see Note [Demand type Divergence] for the meaning of a Divergence in a
strictness signature.

If an Id is applied to less arguments than its arity, it means that
the demand on the function at a call site is weaker than the vanilla
call demand, used for signature inference. Therefore we place a top
demand on all arguments. Otherwise, the demand is specified by Id's
signature.

For example, the demand transformer described by the demand signature
        StrictSig (DmdType {x -&gt; &lt;S,1*U&gt;} &lt;L,A&gt;&lt;L,U(U,U)&gt;m)
says that when the function is applied to two arguments, it
unleashes demand &lt;S,1*U&gt; on the free var x, &lt;L,A&gt; on the first arg,
and &lt;L,U(U,U)&gt; on the second, then returning a constructor.

If this same function is applied to one arg, all we can say is that it
uses x with &lt;L,U&gt;, and its arg with demand &lt;L,U&gt;.

Note [Understanding DmdType and StrictSig]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Demand types are sound approximations of an expression's semantics relative to
the incoming demand we put the expression under. Consider the following
expression:

    \x y -&gt; x `seq` (y, 2*x)

Here is a table with demand types resulting from different incoming demands we
put that expression under. Note the monotonicity; a stronger incoming demand
yields a more precise demand type:

    incoming demand                  |  demand type
    ----------------------------------------------------
    &lt;S           ,HU              &gt;  |  &lt;L,U&gt;&lt;L,U&gt;{}
    &lt;C(C(S     )),C1(C1(U       ))&gt;  |  &lt;S,U&gt;&lt;L,U&gt;{}
    &lt;C(C(S(S,L))),C1(C1(U(1*U,A)))&gt;  |  &lt;S,1*HU&gt;&lt;L,A&gt;{}

Note that in the first example, the depth of the demand type was *higher* than
the arity of the incoming call demand due to the anonymous lambda.
The converse is also possible and happens when we unleash demand signatures.
In @f x y@, the incoming call demand on f has arity 2. But if all we have is a
demand signature with depth 1 for @f@ (which we can safely unleash, see below),
the demand type of @f@ under a call demand of arity 2 has a *lower* depth of 1.

So: Demand types are elicited by putting an expression under an incoming (call)
demand, the arity of which can be lower or higher than the depth of the
resulting demand type.
In contrast, a demand signature summarises a function's semantics *without*
immediately specifying the incoming demand it was produced under. Despite StrSig
being a newtype wrapper around DmdType, it actually encodes two things:

  * The threshold (i.e., minimum arity) to unleash the signature
  * A demand type that is sound to unleash when the minimum arity requirement is
    met.

Here comes the subtle part: The threshold is encoded in the wrapped demand
type's depth! So in mkStrictSigForArity we make sure to trim the list of
argument demands to the given threshold arity. Call sites will make sure that
this corresponds to the arity of the call demand that elicited the wrapped
demand type. See also Note [What are demand signatures?] in GHC.Core.Opt.DmdAnal.
-}</span><span>
</span><span id="line-1642"></span><span>
</span><span id="line-1643"></span><span class="hs-comment">-- | The depth of the wrapped 'DmdType' encodes the arity at which it is safe</span><span>
</span><span id="line-1644"></span><span class="hs-comment">-- to unleash. Better construct this through 'mkStrictSigForArity'.</span><span>
</span><span id="line-1645"></span><span class="hs-comment">-- See Note [Understanding DmdType and StrictSig]</span><span>
</span><span id="line-1646"></span><span class="hs-keyword">newtype</span><span> </span><span id="StrictSig"><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-var">StrictSig</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="StrictSig"><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-var">StrictSig</span></a></span></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1647"></span><span>                  </span><span class="hs-keyword">deriving</span><span class="hs-special">(</span><span> </span><span id="local-6989586621680810010"><span id="local-6989586621680810014"><span class="annot"><span class="annottext">StrictSig -&gt; StrictSig -&gt; Bool
(StrictSig -&gt; StrictSig -&gt; Bool)
-&gt; (StrictSig -&gt; StrictSig -&gt; Bool) -&gt; Eq StrictSig
forall a. (a -&gt; a -&gt; Bool) -&gt; (a -&gt; a -&gt; Bool) -&gt; Eq a
/= :: StrictSig -&gt; StrictSig -&gt; Bool
$c/= :: StrictSig -&gt; StrictSig -&gt; Bool
== :: StrictSig -&gt; StrictSig -&gt; Bool
$c== :: StrictSig -&gt; StrictSig -&gt; Bool
</span><span class="hs-identifier hs-var hs-var hs-var hs-var hs-var hs-var">Eq</span></span></span></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-1648"></span><span>
</span><span id="line-1649"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680810004"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1650"></span><span>   </span><span id="local-6989586621680810002"><span class="annot"><span class="annottext">ppr :: StrictSig -&gt; SDoc
</span><a href="#local-6989586621680810002"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span id="local-6989586621680810001"><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810001"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680810001"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1651"></span><span>
</span><span id="line-1652"></span><span class="hs-comment">-- Used for printing top-level strictness pragmas in interface files</span><span>
</span><span id="line-1653"></span><span class="annot"><a href="GHC.Types.Demand.html#pprIfaceStrictSig"><span class="hs-identifier hs-type">pprIfaceStrictSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-1654"></span><span id="pprIfaceStrictSig"><span class="annot"><span class="annottext">pprIfaceStrictSig :: StrictSig -&gt; SDoc
</span><a href="GHC.Types.Demand.html#pprIfaceStrictSig"><span class="hs-identifier hs-var hs-var">pprIfaceStrictSig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680810000"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810000"><span class="hs-identifier hs-var">dmds</span></a></span></span><span> </span><span id="local-6989586621680809999"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809999"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1655"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hcat"><span class="hs-identifier hs-var">hcat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Demand -&gt; SDoc) -&gt; [Demand] -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680810000"><span class="hs-identifier hs-var">dmds</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809999"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1656"></span><span>
</span><span id="line-1657"></span><span class="hs-comment">-- | Turns a 'DmdType' computed for the particular 'Arity' into a 'StrictSig'</span><span>
</span><span id="line-1658"></span><span class="hs-comment">-- unleashable at that arity. See Note [Understanding DmdType and StrictSig]</span><span>
</span><span id="line-1659"></span><span class="annot"><a href="GHC.Types.Demand.html#mkStrictSigForArity"><span class="hs-identifier hs-type">mkStrictSigForArity</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span>
</span><span id="line-1660"></span><span id="mkStrictSigForArity"><span class="annot"><span class="annottext">mkStrictSigForArity :: Int -&gt; DmdType -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#mkStrictSigForArity"><span class="hs-identifier hs-var hs-var">mkStrictSigForArity</span></a></span></span><span> </span><span id="local-6989586621680809998"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809998"><span class="hs-identifier hs-var">arity</span></a></span></span><span> </span><span id="local-6989586621680809997"><span class="annot"><span class="annottext">dmd_ty :: DmdType
</span><a href="#local-6989586621680809997"><span class="hs-identifier hs-var">dmd_ty</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680809996"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680809996"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span id="local-6989586621680809995"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809995"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621680809994"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809994"><span class="hs-identifier hs-var">div</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1661"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809998"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; Int
</span><a href="GHC.Types.Demand.html#dmdTypeDepth"><span class="hs-identifier hs-var">dmdTypeDepth</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809997"><span class="hs-identifier hs-var">dmd_ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-var">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680809996"><span class="hs-identifier hs-var">fvs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; [Demand] -&gt; [Demand]
forall a. Int -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#take"><span class="hs-identifier hs-var">take</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809998"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809995"><span class="hs-identifier hs-var">args</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809994"><span class="hs-identifier hs-var">div</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1662"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-var">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#etaExpandDmdType"><span class="hs-identifier hs-var">etaExpandDmdType</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809998"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809997"><span class="hs-identifier hs-var">dmd_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1663"></span><span>
</span><span id="line-1664"></span><span class="annot"><a href="GHC.Types.Demand.html#mkClosedStrictSig"><span class="hs-identifier hs-type">mkClosedStrictSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span>
</span><span id="line-1665"></span><span id="mkClosedStrictSig"><span class="annot"><span class="annottext">mkClosedStrictSig :: [Demand] -&gt; Divergence -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#mkClosedStrictSig"><span class="hs-identifier hs-var hs-var">mkClosedStrictSig</span></a></span></span><span> </span><span id="local-6989586621680809992"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809992"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span id="local-6989586621680809991"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809991"><span class="hs-identifier hs-var">res</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; DmdType -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#mkStrictSigForArity"><span class="hs-identifier hs-var">mkStrictSigForArity</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Demand] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809992"><span class="hs-identifier hs-var">ds</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="GHC.Types.Demand.html#emptyDmdEnv"><span class="hs-identifier hs-var">emptyDmdEnv</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809992"><span class="hs-identifier hs-var">ds</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809991"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1666"></span><span>
</span><span id="line-1667"></span><span class="annot"><a href="GHC.Types.Demand.html#splitStrictSig"><span class="hs-identifier hs-type">splitStrictSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1668"></span><span id="splitStrictSig"><span class="annot"><span class="annottext">splitStrictSig :: StrictSig -&gt; ([Demand], Divergence)
</span><a href="GHC.Types.Demand.html#splitStrictSig"><span class="hs-identifier hs-var hs-var">splitStrictSig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680809990"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809990"><span class="hs-identifier hs-var">dmds</span></a></span></span><span> </span><span id="local-6989586621680809989"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809989"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809990"><span class="hs-identifier hs-var">dmds</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809989"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1669"></span><span>
</span><span id="line-1670"></span><span class="annot"><a href="GHC.Types.Demand.html#prependArgsStrictSig"><span class="hs-identifier hs-type">prependArgsStrictSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span>
</span><span id="line-1671"></span><span class="hs-comment">-- ^ Add extra ('topDmd') arguments to a strictness signature.</span><span>
</span><span id="line-1672"></span><span class="hs-comment">-- In contrast to 'etaConvertStrictSig', this /prepends/ additional argument</span><span>
</span><span id="line-1673"></span><span class="hs-comment">-- demands. This is used by FloatOut.</span><span>
</span><span id="line-1674"></span><span id="prependArgsStrictSig"><span class="annot"><span class="annottext">prependArgsStrictSig :: Int -&gt; StrictSig -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#prependArgsStrictSig"><span class="hs-identifier hs-var hs-var">prependArgsStrictSig</span></a></span></span><span> </span><span id="local-6989586621680809988"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809988"><span class="hs-identifier hs-var">new_args</span></a></span></span><span> </span><span id="local-6989586621680809987"><span class="annot"><span class="annottext">sig :: StrictSig
</span><a href="#local-6989586621680809987"><span class="hs-identifier hs-var">sig</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span id="local-6989586621680809986"><span class="annot"><span class="annottext">dmd_ty :: DmdType
</span><a href="#local-6989586621680809986"><span class="hs-identifier hs-var">dmd_ty</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680809985"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680809985"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680809984"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809984"><span class="hs-identifier hs-var">dmds</span></a></span></span><span> </span><span id="local-6989586621680809983"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809983"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1675"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809988"><span class="hs-identifier hs-var">new_args</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictSig
</span><a href="#local-6989586621680809987"><span class="hs-identifier hs-var">sig</span></a></span><span>
</span><span id="line-1676"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; Bool
</span><a href="GHC.Types.Demand.html#isTopDmdType"><span class="hs-identifier hs-var">isTopDmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809986"><span class="hs-identifier hs-var">dmd_ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StrictSig
</span><a href="#local-6989586621680809987"><span class="hs-identifier hs-var">sig</span></a></span><span>
</span><span id="line-1677"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809988"><span class="hs-identifier hs-var">new_args</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; StrictSig
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;prependArgsStrictSig: negative new_args&quot;</span></span><span>
</span><span id="line-1678"></span><span>                                   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809988"><span class="hs-identifier hs-var">new_args</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">StrictSig -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">StrictSig
</span><a href="#local-6989586621680809987"><span class="hs-identifier hs-var">sig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1679"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-var">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680809985"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809982"><span class="hs-identifier hs-var">dmds'</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809983"><span class="hs-identifier hs-var">res</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1680"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1681"></span><span>    </span><span id="local-6989586621680809982"><span class="annot"><span class="annottext">dmds' :: [Demand]
</span><a href="#local-6989586621680809982"><span class="hs-identifier hs-var hs-var">dmds'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; Demand -&gt; [Demand]
forall a. Int -&gt; a -&gt; [a]
</span><a href="../../base/src/GHC.List.html#replicate"><span class="hs-identifier hs-var">replicate</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809988"><span class="hs-identifier hs-var">new_args</span></a></span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="GHC.Types.Demand.html#topDmd"><span class="hs-identifier hs-var">topDmd</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; [Demand] -&gt; [Demand]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809984"><span class="hs-identifier hs-var">dmds</span></a></span><span>
</span><span id="line-1682"></span><span>
</span><span id="line-1683"></span><span class="annot"><a href="GHC.Types.Demand.html#etaConvertStrictSig"><span class="hs-identifier hs-type">etaConvertStrictSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span>
</span><span id="line-1684"></span><span class="hs-comment">-- ^ We are expanding (\x y. e) to (\x y z. e z) or reducing from the latter to</span><span>
</span><span id="line-1685"></span><span class="hs-comment">-- the former (when the Simplifier identifies a new join points, for example).</span><span>
</span><span id="line-1686"></span><span class="hs-comment">-- In contrast to 'prependArgsStrictSig', this /appends/ extra arg demands if</span><span>
</span><span id="line-1687"></span><span class="hs-comment">-- necessary.</span><span>
</span><span id="line-1688"></span><span class="hs-comment">-- This works by looking at the 'DmdType' (which was produced under a call</span><span>
</span><span id="line-1689"></span><span class="hs-comment">-- demand for the old arity) and trying to transfer as many facts as we can to</span><span>
</span><span id="line-1690"></span><span class="hs-comment">-- the call demand of new arity.</span><span>
</span><span id="line-1691"></span><span class="hs-comment">-- An arity increase (resulting in a stronger incoming demand) can retain much</span><span>
</span><span id="line-1692"></span><span class="hs-comment">-- of the info, while an arity decrease (a weakening of the incoming demand)</span><span>
</span><span id="line-1693"></span><span class="hs-comment">-- must fall back to a conservative default.</span><span>
</span><span id="line-1694"></span><span id="etaConvertStrictSig"><span class="annot"><span class="annottext">etaConvertStrictSig :: Int -&gt; StrictSig -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#etaConvertStrictSig"><span class="hs-identifier hs-var hs-var">etaConvertStrictSig</span></a></span></span><span> </span><span id="local-6989586621680809981"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809981"><span class="hs-identifier hs-var">arity</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span id="local-6989586621680809980"><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809980"><span class="hs-identifier hs-var">dmd_ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1695"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809981"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Ord a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">&lt;</span></span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; Int
</span><a href="GHC.Types.Demand.html#dmdTypeDepth"><span class="hs-identifier hs-var">dmdTypeDepth</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809980"><span class="hs-identifier hs-var">dmd_ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-var">StrictSig</span></a></span><span> </span><span class="annot"><span class="annottext">(DmdType -&gt; StrictSig) -&gt; DmdType -&gt; StrictSig
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#decreaseArityDmdType"><span class="hs-identifier hs-var">decreaseArityDmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809980"><span class="hs-identifier hs-var">dmd_ty</span></a></span><span>
</span><span id="line-1696"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-var">StrictSig</span></a></span><span> </span><span class="annot"><span class="annottext">(DmdType -&gt; StrictSig) -&gt; DmdType -&gt; StrictSig
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#etaExpandDmdType"><span class="hs-identifier hs-var">etaExpandDmdType</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809981"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809980"><span class="hs-identifier hs-var">dmd_ty</span></a></span><span>
</span><span id="line-1697"></span><span>
</span><span id="line-1698"></span><span class="annot"><a href="GHC.Types.Demand.html#isTopSig"><span class="hs-identifier hs-type">isTopSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1699"></span><span id="isTopSig"><span class="annot"><span class="annottext">isTopSig :: StrictSig -&gt; Bool
</span><a href="GHC.Types.Demand.html#isTopSig"><span class="hs-identifier hs-var hs-var">isTopSig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span id="local-6989586621680809979"><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809979"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; Bool
</span><a href="GHC.Types.Demand.html#isTopDmdType"><span class="hs-identifier hs-var">isTopDmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809979"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1700"></span><span>
</span><span id="line-1701"></span><span class="annot"><a href="GHC.Types.Demand.html#hasDemandEnvSig"><span class="hs-identifier hs-type">hasDemandEnvSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1702"></span><span id="hasDemandEnvSig"><span class="annot"><span class="annottext">hasDemandEnvSig :: StrictSig -&gt; Bool
</span><a href="GHC.Types.Demand.html#hasDemandEnvSig"><span class="hs-identifier hs-var hs-var">hasDemandEnvSig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680809978"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680809978"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdEnv -&gt; Bool
forall a. VarEnv a -&gt; Bool
</span><a href="GHC.Types.Var.Env.html#isEmptyVarEnv"><span class="hs-identifier hs-var">isEmptyVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680809978"><span class="hs-identifier hs-var">env</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1703"></span><span>
</span><span id="line-1704"></span><span class="annot"><a href="GHC.Types.Demand.html#strictSigDmdEnv"><span class="hs-identifier hs-type">strictSigDmdEnv</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdEnv"><span class="hs-identifier hs-type">DmdEnv</span></a></span><span>
</span><span id="line-1705"></span><span id="strictSigDmdEnv"><span class="annot"><span class="annottext">strictSigDmdEnv :: StrictSig -&gt; DmdEnv
</span><a href="GHC.Types.Demand.html#strictSigDmdEnv"><span class="hs-identifier hs-var hs-var">strictSigDmdEnv</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680809977"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680809977"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680809977"><span class="hs-identifier hs-var">env</span></a></span><span>
</span><span id="line-1706"></span><span>
</span><span id="line-1707"></span><span class="hs-comment">-- | True if the signature diverges or throws an exception in a saturated call.</span><span>
</span><span id="line-1708"></span><span class="hs-comment">-- See Note [Dead ends].</span><span>
</span><span id="line-1709"></span><span class="annot"><a href="GHC.Types.Demand.html#isDeadEndSig"><span class="hs-identifier hs-type">isDeadEndSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1710"></span><span id="isDeadEndSig"><span class="annot"><span class="annottext">isDeadEndSig :: StrictSig -&gt; Bool
</span><a href="GHC.Types.Demand.html#isDeadEndSig"><span class="hs-identifier hs-var hs-var">isDeadEndSig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680809976"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809976"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; Bool
</span><a href="GHC.Types.Demand.html#isDeadEndDiv"><span class="hs-identifier hs-var">isDeadEndDiv</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809976"><span class="hs-identifier hs-var">res</span></a></span><span>
</span><span id="line-1711"></span><span>
</span><span id="line-1712"></span><span class="annot"><a href="GHC.Types.Demand.html#botSig"><span class="hs-identifier hs-type">botSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span>
</span><span id="line-1713"></span><span id="botSig"><span class="annot"><span class="annottext">botSig :: StrictSig
</span><a href="GHC.Types.Demand.html#botSig"><span class="hs-identifier hs-var hs-var">botSig</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-var">StrictSig</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="GHC.Types.Demand.html#botDmdType"><span class="hs-identifier hs-var">botDmdType</span></a></span><span>
</span><span id="line-1714"></span><span>
</span><span id="line-1715"></span><span class="annot"><a href="GHC.Types.Demand.html#nopSig"><span class="hs-identifier hs-type">nopSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span>
</span><span id="line-1716"></span><span id="nopSig"><span class="annot"><span class="annottext">nopSig :: StrictSig
</span><a href="GHC.Types.Demand.html#nopSig"><span class="hs-identifier hs-var hs-var">nopSig</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-var">StrictSig</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="GHC.Types.Demand.html#nopDmdType"><span class="hs-identifier hs-var">nopDmdType</span></a></span><span>
</span><span id="line-1717"></span><span>
</span><span id="line-1718"></span><span class="annot"><a href="GHC.Types.Demand.html#seqStrictSig"><span class="hs-identifier hs-type">seqStrictSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1719"></span><span id="seqStrictSig"><span class="annot"><span class="annottext">seqStrictSig :: StrictSig -&gt; ()
</span><a href="GHC.Types.Demand.html#seqStrictSig"><span class="hs-identifier hs-var hs-var">seqStrictSig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span id="local-6989586621680809975"><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809975"><span class="hs-identifier hs-var">ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; ()
</span><a href="GHC.Types.Demand.html#seqDmdType"><span class="hs-identifier hs-var">seqDmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809975"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-1720"></span><span>
</span><span id="line-1721"></span><span class="annot"><a href="GHC.Types.Demand.html#dmdTransformSig"><span class="hs-identifier hs-type">dmdTransformSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1722"></span><span class="hs-comment">-- (dmdTransformSig fun_sig dmd) considers a call to a function whose</span><span>
</span><span id="line-1723"></span><span class="hs-comment">-- signature is fun_sig, with demand dmd.  We return the demand</span><span>
</span><span id="line-1724"></span><span class="hs-comment">-- that the function places on its context (eg its args)</span><span>
</span><span id="line-1725"></span><span id="dmdTransformSig"><span class="annot"><span class="annottext">dmdTransformSig :: StrictSig -&gt; CleanDemand -&gt; DmdType
</span><a href="GHC.Types.Demand.html#dmdTransformSig"><span class="hs-identifier hs-var hs-var">dmdTransformSig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span id="local-6989586621680809974"><span class="annot"><span class="annottext">dmd_ty :: DmdType
</span><a href="#local-6989586621680809974"><span class="hs-identifier hs-var">dmd_ty</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680809973"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809973"><span class="hs-identifier hs-var">arg_ds</span></a></span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680809972"><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621680809972"><span class="hs-identifier hs-var">cd</span></a></span></span><span>
</span><span id="line-1726"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdShell -&gt; DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#postProcessUnsat"><span class="hs-identifier hs-var">postProcessUnsat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; CleanDemand -&gt; DmdShell
</span><a href="GHC.Types.Demand.html#peelManyCalls"><span class="hs-identifier hs-var">peelManyCalls</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Demand] -&gt; Int
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Int
</span><a href="../../base/src/Data.Foldable.html#length"><span class="hs-identifier hs-var">length</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809973"><span class="hs-identifier hs-var">arg_ds</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621680809972"><span class="hs-identifier hs-var">cd</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809974"><span class="hs-identifier hs-var">dmd_ty</span></a></span><span>
</span><span id="line-1727"></span><span>    </span><span class="hs-comment">-- see Note [Demands from unsaturated function calls]</span><span>
</span><span id="line-1728"></span><span>
</span><span id="line-1729"></span><span class="annot"><a href="GHC.Types.Demand.html#dmdTransformDataConSig"><span class="hs-identifier hs-type">dmdTransformDataConSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1730"></span><span class="hs-comment">-- Same as dmdTransformSig but for a data constructor (worker),</span><span>
</span><span id="line-1731"></span><span class="hs-comment">-- which has a special kind of demand transformer.</span><span>
</span><span id="line-1732"></span><span class="hs-comment">-- If the constructor is saturated, we feed the demand on</span><span>
</span><span id="line-1733"></span><span class="hs-comment">-- the result into the constructor arguments.</span><span>
</span><span id="line-1734"></span><span id="dmdTransformDataConSig"><span class="annot"><span class="annottext">dmdTransformDataConSig :: Int -&gt; CleanDemand -&gt; DmdType
</span><a href="GHC.Types.Demand.html#dmdTransformDataConSig"><span class="hs-identifier hs-var hs-var">dmdTransformDataConSig</span></a></span></span><span> </span><span id="local-6989586621680809971"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809971"><span class="hs-identifier hs-var">arity</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680809970"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809970"><span class="hs-identifier hs-var">str</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680809969"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809969"><span class="hs-identifier hs-var">abs</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1735"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680809968"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680809968"><span class="hs-identifier hs-var">str_dmds</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; StrDmd -&gt; Maybe [ArgStr]
forall {a}. (Eq a, Num a) =&gt; a -&gt; StrDmd -&gt; Maybe [ArgStr]
</span><a href="#local-6989586621680809967"><span class="hs-identifier hs-var">go_str</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809971"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809970"><span class="hs-identifier hs-var">str</span></a></span><span>
</span><span id="line-1736"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680809966"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680809966"><span class="hs-identifier hs-var">abs_dmds</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Int -&gt; UseDmd -&gt; Maybe [ArgUse]
forall {t}. (Eq t, Num t) =&gt; t -&gt; UseDmd -&gt; Maybe [ArgUse]
</span><a href="#local-6989586621680809965"><span class="hs-identifier hs-var">go_abs</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809971"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809969"><span class="hs-identifier hs-var">abs</span></a></span><span>
</span><span id="line-1737"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="GHC.Types.Demand.html#emptyDmdEnv"><span class="hs-identifier hs-var">emptyDmdEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ArgStr] -&gt; [ArgUse] -&gt; [Demand]
forall s u. [s] -&gt; [u] -&gt; [JointDmd s u]
</span><a href="GHC.Types.Demand.html#mkJointDmds"><span class="hs-identifier hs-var">mkJointDmds</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680809968"><span class="hs-identifier hs-var">str_dmds</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680809966"><span class="hs-identifier hs-var">abs_dmds</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#topDiv"><span class="hs-identifier hs-var">topDiv</span></a></span><span>
</span><span id="line-1738"></span><span>
</span><span id="line-1739"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>   </span><span class="hs-comment">-- Not saturated</span><span>
</span><span id="line-1740"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="GHC.Types.Demand.html#nopDmdType"><span class="hs-identifier hs-var">nopDmdType</span></a></span><span>
</span><span id="line-1741"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1742"></span><span>    </span><span id="local-6989586621680809967"><span class="annot"><span class="annottext">go_str :: a -&gt; StrDmd -&gt; Maybe [ArgStr]
</span><a href="#local-6989586621680809967"><span class="hs-identifier hs-var hs-var">go_str</span></a></span></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-number">0</span></span><span> </span><span id="local-6989586621680809956"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809956"><span class="hs-identifier hs-var">dmd</span></a></span></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; StrDmd -&gt; Maybe [ArgStr]
</span><a href="GHC.Types.Demand.html#splitStrProdDmd"><span class="hs-identifier hs-var">splitStrProdDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809971"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809956"><span class="hs-identifier hs-var">dmd</span></a></span><span>
</span><span id="line-1743"></span><span>    </span><span class="annot"><a href="#local-6989586621680809967"><span class="hs-identifier hs-var">go_str</span></a></span><span> </span><span id="local-6989586621680809955"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680809955"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680809954"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809954"><span class="hs-identifier hs-var">s'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; StrDmd -&gt; Maybe [ArgStr]
</span><a href="#local-6989586621680809967"><span class="hs-identifier hs-var">go_str</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680809955"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809954"><span class="hs-identifier hs-var">s'</span></a></span><span>
</span><span id="line-1744"></span><span>    </span><span class="annot"><a href="#local-6989586621680809967"><span class="hs-identifier hs-var">go_str</span></a></span><span> </span><span id="local-6989586621680809953"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680809953"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">a -&gt; StrDmd -&gt; Maybe [ArgStr]
</span><a href="#local-6989586621680809967"><span class="hs-identifier hs-var">go_str</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621680809953"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">a -&gt; a -&gt; a
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">a
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>
</span><span id="line-1745"></span><span>    </span><span class="annot"><a href="#local-6989586621680809967"><span class="hs-identifier hs-var">go_str</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><span class="hs-identifier">_</span></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe [ArgStr]
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1746"></span><span>
</span><span id="line-1747"></span><span>    </span><span id="local-6989586621680809965"><span class="annot"><span class="annottext">go_abs :: t -&gt; UseDmd -&gt; Maybe [ArgUse]
</span><a href="#local-6989586621680809965"><span class="hs-identifier hs-var hs-var">go_abs</span></a></span></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-number">0</span></span><span> </span><span id="local-6989586621680809946"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809946"><span class="hs-identifier hs-var">dmd</span></a></span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int -&gt; UseDmd -&gt; Maybe [ArgUse]
</span><a href="GHC.Types.Demand.html#splitUseProdDmd"><span class="hs-identifier hs-var">splitUseProdDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809971"><span class="hs-identifier hs-var">arity</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809946"><span class="hs-identifier hs-var">dmd</span></a></span><span>
</span><span id="line-1748"></span><span>    </span><span class="annot"><a href="#local-6989586621680809965"><span class="hs-identifier hs-var">go_abs</span></a></span><span> </span><span id="local-6989586621680809945"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680809945"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span id="local-6989586621680809944"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809944"><span class="hs-identifier hs-var">u'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; UseDmd -&gt; Maybe [ArgUse]
</span><a href="#local-6989586621680809965"><span class="hs-identifier hs-var">go_abs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680809945"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">t
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809944"><span class="hs-identifier hs-var">u'</span></a></span><span>
</span><span id="line-1749"></span><span>    </span><span class="annot"><a href="#local-6989586621680809965"><span class="hs-identifier hs-var">go_abs</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe [ArgUse]
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1750"></span><span>
</span><span id="line-1751"></span><span class="annot"><a href="GHC.Types.Demand.html#dmdTransformDictSelSig"><span class="hs-identifier hs-type">dmdTransformDictSelSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#CleanDemand"><span class="hs-identifier hs-type">CleanDemand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span>
</span><span id="line-1752"></span><span class="hs-comment">-- Like dmdTransformDataConSig, we have a special demand transformer</span><span>
</span><span id="line-1753"></span><span class="hs-comment">-- for dictionary selectors.  If the selector is saturated (ie has one</span><span>
</span><span id="line-1754"></span><span class="hs-comment">-- argument: the dictionary), we feed the demand on the result into</span><span>
</span><span id="line-1755"></span><span class="hs-comment">-- the indicated dictionary component.</span><span>
</span><span id="line-1756"></span><span id="dmdTransformDictSelSig"><span class="annot"><span class="annottext">dmdTransformDictSelSig :: StrictSig -&gt; CleanDemand -&gt; DmdType
</span><a href="GHC.Types.Demand.html#dmdTransformDictSelSig"><span class="hs-identifier hs-var hs-var">dmdTransformDictSelSig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span id="local-6989586621680809943"><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809943"><span class="hs-identifier hs-var">dict_dmd</span></a></span></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680809942"><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621680809942"><span class="hs-identifier hs-var">cd</span></a></span></span><span>
</span><span id="line-1757"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621680809941"><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621680809941"><span class="hs-identifier hs-var">cd'</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621680809940"><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621680809940"><span class="hs-identifier hs-var">defer_use</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CleanDemand -&gt; (CleanDemand, DmdShell)
</span><a href="GHC.Types.Demand.html#peelCallDmd"><span class="hs-identifier hs-var">peelCallDmd</span></a></span><span> </span><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621680809942"><span class="hs-identifier hs-var">cd</span></a></span><span>
</span><span id="line-1758"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680809939"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809939"><span class="hs-identifier hs-var">jds</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Maybe [Demand]
</span><a href="GHC.Types.Demand.html#splitProdDmd_maybe"><span class="hs-identifier hs-var">splitProdDmd_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809943"><span class="hs-identifier hs-var">dict_dmd</span></a></span><span>
</span><span id="line-1759"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdShell -&gt; DmdType -&gt; DmdType
</span><a href="GHC.Types.Demand.html#postProcessUnsat"><span class="hs-identifier hs-var">postProcessUnsat</span></a></span><span> </span><span class="annot"><span class="annottext">DmdShell
</span><a href="#local-6989586621680809940"><span class="hs-identifier hs-var">defer_use</span></a></span><span> </span><span class="annot"><span class="annottext">(DmdType -&gt; DmdType) -&gt; DmdType -&gt; DmdType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1760"></span><span>     </span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="GHC.Types.Demand.html#emptyDmdEnv"><span class="hs-identifier hs-var">emptyDmdEnv</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">CleanDemand -&gt; Demand
</span><a href="GHC.Types.Demand.html#mkOnceUsedDmd"><span class="hs-identifier hs-var">mkOnceUsedDmd</span></a></span><span> </span><span class="annot"><span class="annottext">(CleanDemand -&gt; Demand) -&gt; CleanDemand -&gt; Demand
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; CleanDemand
</span><a href="GHC.Types.Demand.html#mkProdDmd"><span class="hs-identifier hs-var">mkProdDmd</span></a></span><span> </span><span class="annot"><span class="annottext">([Demand] -&gt; CleanDemand) -&gt; [Demand] -&gt; CleanDemand
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Demand -&gt; Demand) -&gt; [Demand] -&gt; [Demand]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CleanDemand -&gt; Demand -&gt; Demand
</span><a href="#local-6989586621680809938"><span class="hs-identifier hs-var">enhance</span></a></span><span> </span><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621680809941"><span class="hs-identifier hs-var">cd'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809939"><span class="hs-identifier hs-var">jds</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#topDiv"><span class="hs-identifier hs-var">topDiv</span></a></span><span>
</span><span id="line-1761"></span><span>   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1762"></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="GHC.Types.Demand.html#nopDmdType"><span class="hs-identifier hs-var">nopDmdType</span></a></span><span> </span><span class="hs-comment">-- See Note [Demand transformer for a dictionary selector]</span><span>
</span><span id="line-1763"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1764"></span><span>    </span><span id="local-6989586621680809938"><span class="annot"><span class="annottext">enhance :: CleanDemand -&gt; Demand -&gt; Demand
</span><a href="#local-6989586621680809938"><span class="hs-identifier hs-var hs-var">enhance</span></a></span></span><span> </span><span id="local-6989586621680809937"><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621680809937"><span class="hs-identifier hs-var">cd</span></a></span></span><span> </span><span id="local-6989586621680809936"><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809936"><span class="hs-identifier hs-var">old</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Bool
forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isAbsDmd"><span class="hs-identifier hs-var">isAbsDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809936"><span class="hs-identifier hs-var">old</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809936"><span class="hs-identifier hs-var">old</span></a></span><span>
</span><span id="line-1765"></span><span>                   </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CleanDemand -&gt; Demand
</span><a href="GHC.Types.Demand.html#mkOnceUsedDmd"><span class="hs-identifier hs-var">mkOnceUsedDmd</span></a></span><span> </span><span class="annot"><span class="annottext">CleanDemand
</span><a href="#local-6989586621680809937"><span class="hs-identifier hs-var">cd</span></a></span><span>  </span><span class="hs-comment">-- This is the one!</span><span>
</span><span id="line-1766"></span><span>
</span><span id="line-1767"></span><span class="annot"><a href="GHC.Types.Demand.html#dmdTransformDictSelSig"><span class="hs-identifier hs-var">dmdTransformDictSelSig</span></a></span><span> </span><span class="annot"><span class="annottext">StrictSig
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">CleanDemand
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; DmdType
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;dmdTransformDictSelSig: no args&quot;</span></span><span>
</span><span id="line-1768"></span><span>
</span><span id="line-1769"></span><span class="hs-comment">{-
Note [Demand transformer for a dictionary selector]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If we evaluate (op dict-expr) under demand 'd', then we can push the demand 'd'
into the appropriate field of the dictionary. What *is* the appropriate field?
We just look at the strictness signature of the class op, which will be
something like: U(AAASAAAAA).  Then replace the 'S' by the demand 'd'.

For single-method classes, which are represented by newtypes the signature
of 'op' won't look like U(...), so the splitProdDmd_maybe will fail.
That's fine: if we are doing strictness analysis we are also doing inlining,
so we'll have inlined 'op' into a cast.  So we can bale out in a conservative
way, returning nopDmdType.

It is (just.. #8329) possible to be running strictness analysis *without*
having inlined class ops from single-method classes.  Suppose you are using
ghc --make; and the first module has a local -O0 flag.  So you may load a class
without interface pragmas, ie (currently) without an unfolding for the class
ops.   Now if a subsequent module in the --make sweep has a local -O flag
you might do strictness analysis, but there is no inlining for the class op.
This is weird, so I'm not worried about whether this optimises brilliantly; but
it should not fall over.
-}</span><span>
</span><span id="line-1792"></span><span>
</span><span id="line-1793"></span><span class="annot"><a href="GHC.Types.Demand.html#argsOneShots"><span class="hs-identifier hs-type">argsOneShots</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#Arity"><span class="hs-identifier hs-type">Arity</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Basic.html#OneShotInfo"><span class="hs-identifier hs-type">OneShotInfo</span></a></span><span class="hs-special">]</span><span class="hs-special">]</span><span>
</span><span id="line-1794"></span><span class="hs-comment">-- See Note [Computing one-shot info]</span><span>
</span><span id="line-1795"></span><span id="argsOneShots"><span class="annot"><span class="annottext">argsOneShots :: StrictSig -&gt; Int -&gt; [[OneShotInfo]]
</span><a href="GHC.Types.Demand.html#argsOneShots"><span class="hs-identifier hs-var hs-var">argsOneShots</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680809934"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809934"><span class="hs-identifier hs-var">arg_ds</span></a></span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680809933"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809933"><span class="hs-identifier hs-var">n_val_args</span></a></span></span><span>
</span><span id="line-1796"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680809932"><span class="hs-identifier hs-var">unsaturated_call</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1797"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; [[OneShotInfo]]
</span><a href="#local-6989586621680809931"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809934"><span class="hs-identifier hs-var">arg_ds</span></a></span><span>
</span><span id="line-1798"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1799"></span><span>    </span><span id="local-6989586621680809932"><span class="annot"><span class="annottext">unsaturated_call :: Bool
</span><a href="#local-6989586621680809932"><span class="hs-identifier hs-var hs-var">unsaturated_call</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809934"><span class="hs-identifier hs-var">arg_ds</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; Int -&gt; Bool
forall a. [a] -&gt; Int -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthExceeds"><span class="hs-operator hs-var">`lengthExceeds`</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809933"><span class="hs-identifier hs-var">n_val_args</span></a></span><span>
</span><span id="line-1800"></span><span>
</span><span id="line-1801"></span><span>    </span><span id="local-6989586621680809931"><span class="annot"><span class="annottext">go :: [Demand] -&gt; [[OneShotInfo]]
</span><a href="#local-6989586621680809931"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1802"></span><span>    </span><span class="annot"><a href="#local-6989586621680809931"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680809929"><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809929"><span class="hs-identifier hs-var">arg_d</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621680809928"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809928"><span class="hs-identifier hs-var">arg_ds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand -&gt; [OneShotInfo]
</span><a href="GHC.Types.Demand.html#argOneShots"><span class="hs-identifier hs-var">argOneShots</span></a></span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809929"><span class="hs-identifier hs-var">arg_d</span></a></span><span> </span><span class="annot"><span class="annottext">[OneShotInfo] -&gt; [[OneShotInfo]] -&gt; [[OneShotInfo]]
forall {a}. [a] -&gt; [[a]] -&gt; [[a]]
</span><a href="#local-6989586621680809927"><span class="hs-operator hs-var">`cons`</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; [[OneShotInfo]]
</span><a href="#local-6989586621680809931"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809928"><span class="hs-identifier hs-var">arg_ds</span></a></span><span>
</span><span id="line-1803"></span><span>
</span><span id="line-1804"></span><span>    </span><span class="hs-comment">-- Avoid list tail like [ [], [], [] ]</span><span>
</span><span id="line-1805"></span><span>    </span><span id="local-6989586621680809927"><span class="annot"><span class="annottext">cons :: [a] -&gt; [[a]] -&gt; [[a]]
</span><a href="#local-6989586621680809927"><span class="hs-identifier hs-var hs-var">cons</span></a></span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1806"></span><span>    </span><span class="annot"><a href="#local-6989586621680809927"><span class="hs-identifier hs-var">cons</span></a></span><span> </span><span id="local-6989586621680809926"><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680809926"><span class="hs-identifier hs-var">a</span></a></span></span><span>  </span><span id="local-6989586621680809925"><span class="annot"><span class="annottext">[[a]]
</span><a href="#local-6989586621680809925"><span class="hs-keyword hs-var">as</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[a]
</span><a href="#local-6989586621680809926"><span class="hs-identifier hs-var">a</span></a></span><span class="annot"><span class="annottext">[a] -&gt; [[a]] -&gt; [[a]]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[[a]]
</span><a href="#local-6989586621680809925"><span class="hs-keyword hs-var">as</span></a></span><span>
</span><span id="line-1807"></span><span>
</span><span id="line-1808"></span><span class="hs-comment">-- saturatedByOneShots n C1(C1(...)) = True,</span><span>
</span><span id="line-1809"></span><span class="hs-comment">--   &lt;=&gt;</span><span>
</span><span id="line-1810"></span><span class="hs-comment">-- there are at least n nested C1(..) calls</span><span>
</span><span id="line-1811"></span><span class="hs-comment">-- See Note [Demand on the worker] in GHC.Core.Opt.WorkWrap</span><span>
</span><span id="line-1812"></span><span class="annot"><a href="GHC.Types.Demand.html#saturatedByOneShots"><span class="hs-identifier hs-type">saturatedByOneShots</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1813"></span><span id="saturatedByOneShots"><span class="annot"><span class="annottext">saturatedByOneShots :: Int -&gt; Demand -&gt; Bool
</span><a href="GHC.Types.Demand.html#saturatedByOneShots"><span class="hs-identifier hs-var hs-var">saturatedByOneShots</span></a></span></span><span> </span><span id="local-6989586621680809924"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809924"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680809923"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680809923"><span class="hs-identifier hs-var">usg</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1814"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680809923"><span class="hs-identifier hs-var">usg</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1815"></span><span>      </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680809922"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809922"><span class="hs-identifier hs-var">arg_usg</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Int -&gt; UseDmd -&gt; Bool
forall {t}. (Eq t, Num t) =&gt; t -&gt; UseDmd -&gt; Bool
</span><a href="#local-6989586621680809921"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809924"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809922"><span class="hs-identifier hs-var">arg_usg</span></a></span><span>
</span><span id="line-1816"></span><span>      </span><span class="annot"><span class="annottext">ArgUse
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1817"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1818"></span><span>    </span><span id="local-6989586621680809921"><span class="annot"><span class="annottext">go :: t -&gt; UseDmd -&gt; Bool
</span><a href="#local-6989586621680809921"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-number">0</span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1819"></span><span>    </span><span class="annot"><a href="#local-6989586621680809921"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span id="local-6989586621680809914"><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680809914"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span> </span><span id="local-6989586621680809913"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809913"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">t -&gt; UseDmd -&gt; Bool
</span><a href="#local-6989586621680809921"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">t
</span><a href="#local-6989586621680809914"><span class="hs-identifier hs-var">n</span></a></span><span class="annot"><span class="annottext">t -&gt; t -&gt; t
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#-"><span class="hs-glyph hs-var">-</span></a></span><span class="annot"><span class="annottext">t
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809913"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-1820"></span><span>    </span><span class="annot"><a href="#local-6989586621680809921"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">t
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1821"></span><span>
</span><span id="line-1822"></span><span class="annot"><a href="GHC.Types.Demand.html#argOneShots"><span class="hs-identifier hs-type">argOneShots</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>          </span><span class="hs-comment">-- depending on saturation</span><span>
</span><span id="line-1823"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Basic.html#OneShotInfo"><span class="hs-identifier hs-type">OneShotInfo</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1824"></span><span id="argOneShots"><span class="annot"><span class="annottext">argOneShots :: Demand -&gt; [OneShotInfo]
</span><a href="GHC.Types.Demand.html#argOneShots"><span class="hs-identifier hs-var hs-var">argOneShots</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680809912"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680809912"><span class="hs-identifier hs-var">usg</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1825"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680809912"><span class="hs-identifier hs-var">usg</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1826"></span><span>      </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680809911"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809911"><span class="hs-identifier hs-var">arg_usg</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; [OneShotInfo]
</span><a href="#local-6989586621680809910"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809911"><span class="hs-identifier hs-var">arg_usg</span></a></span><span>
</span><span id="line-1827"></span><span>      </span><span class="annot"><span class="annottext">ArgUse
</span><span class="hs-identifier">_</span></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1828"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1829"></span><span>    </span><span id="local-6989586621680809910"><span class="annot"><span class="annottext">go :: UseDmd -&gt; [OneShotInfo]
</span><a href="#local-6989586621680809910"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span>  </span><span id="local-6989586621680809909"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809909"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OneShotInfo
</span><a href="GHC.Types.Basic.html#OneShotLam"><span class="hs-identifier hs-var">OneShotLam</span></a></span><span> </span><span class="annot"><span class="annottext">OneShotInfo -&gt; [OneShotInfo] -&gt; [OneShotInfo]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; [OneShotInfo]
</span><a href="#local-6989586621680809910"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809909"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-1830"></span><span>    </span><span class="annot"><a href="#local-6989586621680809910"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span id="local-6989586621680809907"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809907"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OneShotInfo
</span><a href="GHC.Types.Basic.html#NoOneShotInfo"><span class="hs-identifier hs-var">NoOneShotInfo</span></a></span><span> </span><span class="annot"><span class="annottext">OneShotInfo -&gt; [OneShotInfo] -&gt; [OneShotInfo]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; [OneShotInfo]
</span><a href="#local-6989586621680809910"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809907"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-1831"></span><span>    </span><span class="annot"><a href="#local-6989586621680809910"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1832"></span><span>
</span><span id="line-1833"></span><span class="hs-comment">{- Note [Computing one-shot info]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider a call
    f (\pqr. e1) (\xyz. e2) e3
where f has usage signature
    C1(C(C1(U))) C1(U) U
Then argsOneShots returns a [[OneShotInfo]] of
    [[OneShot,NoOneShotInfo,OneShot],  [OneShot]]
The occurrence analyser propagates this one-shot infor to the
binders \pqr and \xyz; see Note [Use one-shot information] in &quot;GHC.Core.Opt.OccurAnal&quot;.
-}</span><span>
</span><span id="line-1844"></span><span>
</span><span id="line-1845"></span><span class="hs-comment">-- | Returns true if an application to n args would diverge or throw an</span><span>
</span><span id="line-1846"></span><span class="hs-comment">-- exception. See Note [Unsaturated applications] and Note [Dead ends].</span><span>
</span><span id="line-1847"></span><span class="annot"><a href="GHC.Types.Demand.html#appIsDeadEnd"><span class="hs-identifier hs-type">appIsDeadEnd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1848"></span><span id="appIsDeadEnd"><span class="annot"><span class="annottext">appIsDeadEnd :: StrictSig -&gt; Int -&gt; Bool
</span><a href="GHC.Types.Demand.html#appIsDeadEnd"><span class="hs-identifier hs-var hs-var">appIsDeadEnd</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680809905"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809905"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span id="local-6989586621680809904"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809904"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span id="local-6989586621680809903"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809903"><span class="hs-identifier hs-var">n</span></a></span></span><span>
</span><span id="line-1849"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; Bool
</span><a href="GHC.Types.Demand.html#isDeadEndDiv"><span class="hs-identifier hs-var">isDeadEndDiv</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809904"><span class="hs-identifier hs-var">res</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Demand] -&gt; Int -&gt; Bool
forall a. [a] -&gt; Int -&gt; Bool
</span><a href="GHC.Utils.Misc.html#lengthExceeds"><span class="hs-identifier hs-var">lengthExceeds</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809905"><span class="hs-identifier hs-var">ds</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680809903"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1850"></span><span>
</span><span id="line-1851"></span><span class="hs-comment">{-
Note [Unsaturated applications]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If a function having bottom as its demand result is applied to a less
number of arguments than its syntactic arity, we cannot say for sure
that it is going to diverge. This is the reason why we use the
function appIsDeadEnd, which, given a strictness signature and a number
of arguments, says conservatively if the function is never going to return.
See Note [Dead ends].
-}</span><span>
</span><span id="line-1861"></span><span>
</span><span id="line-1862"></span><span class="annot"><a href="GHC.Types.Demand.html#zapUsageEnvSig"><span class="hs-identifier hs-type">zapUsageEnvSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span>
</span><span id="line-1863"></span><span class="hs-comment">-- Remove the usage environment from the demand</span><span>
</span><span id="line-1864"></span><span id="zapUsageEnvSig"><span class="annot"><span class="annottext">zapUsageEnvSig :: StrictSig -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#zapUsageEnvSig"><span class="hs-identifier hs-var hs-var">zapUsageEnvSig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680809902"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809902"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span id="local-6989586621680809901"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809901"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; Divergence -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#mkClosedStrictSig"><span class="hs-identifier hs-var">mkClosedStrictSig</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809902"><span class="hs-identifier hs-var">ds</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809901"><span class="hs-identifier hs-var">r</span></a></span><span>
</span><span id="line-1865"></span><span>
</span><span id="line-1866"></span><span class="annot"><a href="GHC.Types.Demand.html#zapUsageDemand"><span class="hs-identifier hs-type">zapUsageDemand</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-1867"></span><span class="hs-comment">-- Remove the usage info, but not the strictness info, from the demand</span><span>
</span><span id="line-1868"></span><span id="zapUsageDemand"><span class="annot"><span class="annottext">zapUsageDemand :: Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#zapUsageDemand"><span class="hs-identifier hs-var hs-var">zapUsageDemand</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">KillFlags -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#kill_usage"><span class="hs-identifier hs-var">kill_usage</span></a></span><span> </span><span class="annot"><span class="annottext">(KillFlags -&gt; Demand -&gt; Demand) -&gt; KillFlags -&gt; Demand -&gt; Demand
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">KillFlags :: Bool -&gt; Bool -&gt; Bool -&gt; KillFlags
</span><a href="GHC.Types.Demand.html#KillFlags"><span class="hs-identifier hs-type">KillFlags</span></a></span><span>
</span><span id="line-1869"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">kf_abs :: Bool
</span><a href="GHC.Types.Demand.html#kf_abs"><span class="hs-identifier hs-var">kf_abs</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1870"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">kf_used_once :: Bool
</span><a href="GHC.Types.Demand.html#kf_used_once"><span class="hs-identifier hs-var">kf_used_once</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1871"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">kf_called_once :: Bool
</span><a href="GHC.Types.Demand.html#kf_called_once"><span class="hs-identifier hs-var">kf_called_once</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1872"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-1873"></span><span>
</span><span id="line-1874"></span><span class="hs-comment">-- | Remove all 1* information (but not C1 information) from the demand</span><span>
</span><span id="line-1875"></span><span class="annot"><a href="GHC.Types.Demand.html#zapUsedOnceDemand"><span class="hs-identifier hs-type">zapUsedOnceDemand</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-1876"></span><span id="zapUsedOnceDemand"><span class="annot"><span class="annottext">zapUsedOnceDemand :: Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#zapUsedOnceDemand"><span class="hs-identifier hs-var hs-var">zapUsedOnceDemand</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">KillFlags -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#kill_usage"><span class="hs-identifier hs-var">kill_usage</span></a></span><span> </span><span class="annot"><span class="annottext">(KillFlags -&gt; Demand -&gt; Demand) -&gt; KillFlags -&gt; Demand -&gt; Demand
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">KillFlags :: Bool -&gt; Bool -&gt; Bool -&gt; KillFlags
</span><a href="GHC.Types.Demand.html#KillFlags"><span class="hs-identifier hs-type">KillFlags</span></a></span><span>
</span><span id="line-1877"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">kf_abs :: Bool
</span><a href="GHC.Types.Demand.html#kf_abs"><span class="hs-identifier hs-var">kf_abs</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1878"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">kf_used_once :: Bool
</span><a href="GHC.Types.Demand.html#kf_used_once"><span class="hs-identifier hs-var">kf_used_once</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1879"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">kf_called_once :: Bool
</span><a href="GHC.Types.Demand.html#kf_called_once"><span class="hs-identifier hs-var">kf_called_once</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1880"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-1881"></span><span>
</span><span id="line-1882"></span><span class="hs-comment">-- | Remove all 1* information (but not C1 information) from the strictness</span><span>
</span><span id="line-1883"></span><span class="hs-comment">--   signature</span><span>
</span><span id="line-1884"></span><span class="annot"><a href="GHC.Types.Demand.html#zapUsedOnceSig"><span class="hs-identifier hs-type">zapUsedOnceSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span>
</span><span id="line-1885"></span><span id="zapUsedOnceSig"><span class="annot"><span class="annottext">zapUsedOnceSig :: StrictSig -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#zapUsedOnceSig"><span class="hs-identifier hs-var hs-var">zapUsedOnceSig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span id="local-6989586621680809895"><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680809895"><span class="hs-identifier hs-var">env</span></a></span></span><span> </span><span id="local-6989586621680809894"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809894"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span id="local-6989586621680809893"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809893"><span class="hs-identifier hs-var">r</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1886"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DmdType -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-var">StrictSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="#local-6989586621680809895"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Demand -&gt; Demand) -&gt; [Demand] -&gt; [Demand]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#zapUsedOnceDemand"><span class="hs-identifier hs-var">zapUsedOnceDemand</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809894"><span class="hs-identifier hs-var">ds</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809893"><span class="hs-identifier hs-var">r</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1887"></span><span>
</span><span id="line-1888"></span><span class="hs-keyword">data</span><span> </span><span id="KillFlags"><span class="annot"><a href="GHC.Types.Demand.html#KillFlags"><span class="hs-identifier hs-var">KillFlags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="KillFlags"><span class="annot"><a href="GHC.Types.Demand.html#KillFlags"><span class="hs-identifier hs-var">KillFlags</span></a></span></span><span>
</span><span id="line-1889"></span><span>    </span><span class="hs-special">{</span><span> </span><span id="kf_abs"><span class="annot"><span class="annottext">KillFlags -&gt; Bool
</span><a href="GHC.Types.Demand.html#kf_abs"><span class="hs-identifier hs-var hs-var">kf_abs</span></a></span></span><span>         </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1890"></span><span>    </span><span class="hs-special">,</span><span> </span><span id="kf_used_once"><span class="annot"><span class="annottext">KillFlags -&gt; Bool
</span><a href="GHC.Types.Demand.html#kf_used_once"><span class="hs-identifier hs-var hs-var">kf_used_once</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1891"></span><span>    </span><span class="hs-special">,</span><span> </span><span id="kf_called_once"><span class="annot"><span class="annottext">KillFlags -&gt; Bool
</span><a href="GHC.Types.Demand.html#kf_called_once"><span class="hs-identifier hs-var hs-var">kf_called_once</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1892"></span><span>    </span><span class="hs-special">}</span><span>
</span><span id="line-1893"></span><span>
</span><span id="line-1894"></span><span class="annot"><a href="GHC.Types.Demand.html#kill_usage"><span class="hs-identifier hs-type">kill_usage</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#KillFlags"><span class="hs-identifier hs-type">KillFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-1895"></span><span id="kill_usage"><span class="annot"><span class="annottext">kill_usage :: KillFlags -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#kill_usage"><span class="hs-identifier hs-var hs-var">kill_usage</span></a></span></span><span> </span><span id="local-6989586621680809892"><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809892"><span class="hs-identifier hs-var">kfs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680809891"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680809891"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680809890"><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680809890"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680809891"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: ArgUse
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">KillFlags -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#zap_musg"><span class="hs-identifier hs-var">zap_musg</span></a></span><span> </span><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809892"><span class="hs-identifier hs-var">kfs</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="#local-6989586621680809890"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">}</span><span>
</span><span id="line-1896"></span><span>
</span><span id="line-1897"></span><span class="annot"><a href="GHC.Types.Demand.html#zap_musg"><span class="hs-identifier hs-type">zap_musg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#KillFlags"><span class="hs-identifier hs-type">KillFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span><span>
</span><span id="line-1898"></span><span id="zap_musg"><span class="annot"><span class="annottext">zap_musg :: KillFlags -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#zap_musg"><span class="hs-identifier hs-var hs-var">zap_musg</span></a></span></span><span> </span><span id="local-6989586621680809888"><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809888"><span class="hs-identifier hs-var">kfs</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>
</span><span id="line-1899"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">KillFlags -&gt; Bool
</span><a href="GHC.Types.Demand.html#kf_abs"><span class="hs-identifier hs-var hs-var">kf_abs</span></a></span><span> </span><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809888"><span class="hs-identifier hs-var">kfs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#useTop"><span class="hs-identifier hs-var">useTop</span></a></span><span>
</span><span id="line-1900"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgUse
forall u. Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>
</span><span id="line-1901"></span><span class="annot"><a href="GHC.Types.Demand.html#zap_musg"><span class="hs-identifier hs-var">zap_musg</span></a></span><span> </span><span id="local-6989586621680809887"><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809887"><span class="hs-identifier hs-var">kfs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span id="local-6989586621680809886"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809886"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680809885"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809885"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1902"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">KillFlags -&gt; Bool
</span><a href="GHC.Types.Demand.html#kf_used_once"><span class="hs-identifier hs-var hs-var">kf_used_once</span></a></span><span> </span><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809887"><span class="hs-identifier hs-var">kfs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">KillFlags -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#zap_usg"><span class="hs-identifier hs-var">zap_usg</span></a></span><span> </span><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809887"><span class="hs-identifier hs-var">kfs</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809885"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1903"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809886"><span class="hs-identifier hs-var">c</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">KillFlags -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#zap_usg"><span class="hs-identifier hs-var">zap_usg</span></a></span><span> </span><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809887"><span class="hs-identifier hs-var">kfs</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809885"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1904"></span><span>
</span><span id="line-1905"></span><span class="annot"><a href="GHC.Types.Demand.html#zap_usg"><span class="hs-identifier hs-type">zap_usg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#KillFlags"><span class="hs-identifier hs-type">KillFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span><span>
</span><span id="line-1906"></span><span id="zap_usg"><span class="annot"><span class="annottext">zap_usg :: KillFlags -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#zap_usg"><span class="hs-identifier hs-var hs-var">zap_usg</span></a></span></span><span> </span><span id="local-6989586621680809883"><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809883"><span class="hs-identifier hs-var">kfs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span id="local-6989586621680809882"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809882"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680809881"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809881"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1907"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">KillFlags -&gt; Bool
</span><a href="GHC.Types.Demand.html#kf_called_once"><span class="hs-identifier hs-var hs-var">kf_called_once</span></a></span><span> </span><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809883"><span class="hs-identifier hs-var">kfs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">KillFlags -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#zap_usg"><span class="hs-identifier hs-var">zap_usg</span></a></span><span> </span><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809883"><span class="hs-identifier hs-var">kfs</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809881"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1908"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809882"><span class="hs-identifier hs-var">c</span></a></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">KillFlags -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#zap_usg"><span class="hs-identifier hs-var">zap_usg</span></a></span><span> </span><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809883"><span class="hs-identifier hs-var">kfs</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809881"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1909"></span><span class="annot"><a href="GHC.Types.Demand.html#zap_usg"><span class="hs-identifier hs-var">zap_usg</span></a></span><span> </span><span id="local-6989586621680809880"><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809880"><span class="hs-identifier hs-var">kfs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680809879"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680809879"><span class="hs-identifier hs-var">us</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ArgUse -&gt; ArgUse) -&gt; [ArgUse] -&gt; [ArgUse]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">KillFlags -&gt; ArgUse -&gt; ArgUse
</span><a href="GHC.Types.Demand.html#zap_musg"><span class="hs-identifier hs-var">zap_musg</span></a></span><span> </span><span class="annot"><span class="annottext">KillFlags
</span><a href="#local-6989586621680809880"><span class="hs-identifier hs-var">kfs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680809879"><span class="hs-identifier hs-var">us</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1910"></span><span class="annot"><a href="GHC.Types.Demand.html#zap_usg"><span class="hs-identifier hs-var">zap_usg</span></a></span><span> </span><span class="annot"><span class="annottext">KillFlags
</span><span class="hs-identifier">_</span></span><span>   </span><span id="local-6989586621680809878"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809878"><span class="hs-identifier hs-var">u</span></a></span></span><span>            </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809878"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-1911"></span><span>
</span><span id="line-1912"></span><span class="hs-comment">-- If the argument is a used non-newtype dictionary, give it strict</span><span>
</span><span id="line-1913"></span><span class="hs-comment">-- demand. Also split the product type &amp; demand and recur in order to</span><span>
</span><span id="line-1914"></span><span class="hs-comment">-- similarly strictify the argument's contained used non-newtype</span><span>
</span><span id="line-1915"></span><span class="hs-comment">-- superclass dictionaries. We use the demand as our recursive measure</span><span>
</span><span id="line-1916"></span><span class="hs-comment">-- to guarantee termination.</span><span>
</span><span id="line-1917"></span><span class="annot"><a href="GHC.Types.Demand.html#strictifyDictDmd"><span class="hs-identifier hs-type">strictifyDictDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-1918"></span><span id="strictifyDictDmd"><span class="annot"><span class="annottext">strictifyDictDmd :: Type -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#strictifyDictDmd"><span class="hs-identifier hs-var hs-var">strictifyDictDmd</span></a></span></span><span> </span><span id="local-6989586621680809877"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680809877"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span id="local-6989586621680809876"><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809876"><span class="hs-identifier hs-var">dmd</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Demand -&gt; ArgUse
forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#getUseDmd"><span class="hs-identifier hs-var">getUseDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809876"><span class="hs-identifier hs-var">dmd</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1919"></span><span>  </span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span id="local-6989586621680809875"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809875"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">|</span><span>
</span><span id="line-1920"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680809874"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680809874"><span class="hs-identifier hs-var">tycon</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680809873"><span class="annot"><span class="annottext">[Type]
</span><a href="#local-6989586621680809873"><span class="hs-identifier hs-var">_arg_tys</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680809872"><span class="annot"><span class="annottext">DataCon
</span><a href="#local-6989586621680809872"><span class="hs-identifier hs-var">_data_con</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680809871"><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621680809871"><span class="hs-identifier hs-var">inst_con_arg_tys</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1921"></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Type -&gt; Maybe (TyCon, [Type], DataCon, [Scaled Type])
</span><a href="GHC.Core.DataCon.html#splitDataProductType_maybe"><span class="hs-identifier hs-var">splitDataProductType_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621680809877"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1922"></span><span>    </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isNewTyCon"><span class="hs-identifier hs-var">isNewTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680809874"><span class="hs-identifier hs-var">tycon</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Bool
</span><a href="GHC.Core.TyCon.html#isClassTyCon"><span class="hs-identifier hs-var">isClassTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621680809874"><span class="hs-identifier hs-var">tycon</span></a></span><span> </span><span class="hs-comment">-- is a non-newtype dictionary</span><span>
</span><span id="line-1923"></span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="GHC.Types.Demand.html#seqDmd"><span class="hs-identifier hs-var">seqDmd</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#bothDmd"><span class="hs-operator hs-var">`bothDmd`</span></a></span><span> </span><span class="hs-comment">-- main idea: ensure it's strict</span><span>
</span><span id="line-1924"></span><span>       </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Maybe [Demand]
</span><a href="GHC.Types.Demand.html#splitProdDmd_maybe"><span class="hs-identifier hs-var">splitProdDmd_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809876"><span class="hs-identifier hs-var">dmd</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1925"></span><span>         </span><span class="hs-comment">-- superclass cycles should not be a problem, since the demand we are</span><span>
</span><span id="line-1926"></span><span>         </span><span class="hs-comment">-- consuming would also have to be infinite in order for us to diverge</span><span>
</span><span id="line-1927"></span><span>         </span><span class="annot"><span class="annottext">Maybe [Demand]
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809876"><span class="hs-identifier hs-var">dmd</span></a></span><span> </span><span class="hs-comment">-- no components have interesting demand, so stop</span><span>
</span><span id="line-1928"></span><span>                        </span><span class="hs-comment">-- looking for superclass dicts</span><span>
</span><span id="line-1929"></span><span>         </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621680809870"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809870"><span class="hs-identifier hs-var">dmds</span></a></span></span><span>
</span><span id="line-1930"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">(Demand -&gt; Bool) -&gt; [Demand] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Demand -&gt; Bool) -&gt; Demand -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Demand -&gt; Bool
forall s u. JointDmd (Str s) (Use u) -&gt; Bool
</span><a href="GHC.Types.Demand.html#isAbsDmd"><span class="hs-identifier hs-var">isAbsDmd</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809870"><span class="hs-identifier hs-var">dmds</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="GHC.Types.Demand.html#evalDmd"><span class="hs-identifier hs-var">evalDmd</span></a></span><span>
</span><span id="line-1931"></span><span>             </span><span class="hs-comment">-- abstract to strict w/ arbitrary component use, since this</span><span>
</span><span id="line-1932"></span><span>             </span><span class="hs-comment">-- smells like reboxing; results in CBV boxed</span><span>
</span><span id="line-1933"></span><span>             </span><span class="hs-comment">--</span><span>
</span><span id="line-1934"></span><span>             </span><span class="hs-comment">-- TODO revisit this if we ever do boxity analysis</span><span>
</span><span id="line-1935"></span><span>           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Demand] -&gt; CleanDemand
</span><a href="GHC.Types.Demand.html#mkProdDmd"><span class="hs-identifier hs-var">mkProdDmd</span></a></span><span> </span><span class="annot"><span class="annottext">([Demand] -&gt; CleanDemand) -&gt; [Demand] -&gt; CleanDemand
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Type -&gt; Demand -&gt; Demand) -&gt; [Type] -&gt; [Demand] -&gt; [Demand]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#strictifyDictDmd"><span class="hs-identifier hs-var">strictifyDictDmd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Scaled Type -&gt; Type) -&gt; [Scaled Type] -&gt; [Type]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Scaled Type -&gt; Type
forall a. Scaled a -&gt; a
</span><a href="GHC.Core.TyCo.Rep.html#scaledThing"><span class="hs-identifier hs-var">scaledThing</span></a></span><span> </span><span class="annot"><span class="annottext">[Scaled Type]
</span><a href="#local-6989586621680809871"><span class="hs-identifier hs-var">inst_con_arg_tys</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809870"><span class="hs-identifier hs-var">dmds</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1936"></span><span>               </span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680809868"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809868"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680809867"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809867"><span class="hs-identifier hs-var">a</span></a></span></span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; ArgUse -&gt; Demand
forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-var">JD</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809868"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809875"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809867"><span class="hs-identifier hs-var">a</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1937"></span><span>             </span><span class="hs-comment">-- TODO could optimize with an aborting variant of zipWith since</span><span>
</span><span id="line-1938"></span><span>             </span><span class="hs-comment">-- the superclass dicts are always a prefix</span><span>
</span><span id="line-1939"></span><span>  </span><span class="annot"><span class="annottext">ArgUse
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809876"><span class="hs-identifier hs-var">dmd</span></a></span><span> </span><span class="hs-comment">-- unused or not a dictionary</span><span>
</span><span id="line-1940"></span><span>
</span><span id="line-1941"></span><span class="annot"><a href="GHC.Types.Demand.html#strictifyDmd"><span class="hs-identifier hs-type">strictifyDmd</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Demand"><span class="hs-identifier hs-type">Demand</span></a></span><span>
</span><span id="line-1942"></span><span id="strictifyDmd"><span class="annot"><span class="annottext">strictifyDmd :: Demand -&gt; Demand
</span><a href="GHC.Types.Demand.html#strictifyDmd"><span class="hs-identifier hs-var hs-var">strictifyDmd</span></a></span></span><span> </span><span id="local-6989586621680809866"><span class="annot"><span class="annottext">dmd :: Demand
</span><a href="#local-6989586621680809866"><span class="hs-identifier hs-var">dmd</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680809865"><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680809865"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1943"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Demand
</span><a href="#local-6989586621680809866"><span class="hs-identifier hs-var">dmd</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: ArgStr
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="#local-6989586621680809865"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; ArgStr -&gt; ArgStr
</span><a href="GHC.Types.Demand.html#bothArgStr"><span class="hs-operator hs-var">`bothArgStr`</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1944"></span><span>
</span><span id="line-1945"></span><span class="hs-comment">{-
Note [HyperStr and Use demands]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The information &quot;HyperStr&quot; needs to be in the strictness signature, and not in
the demand signature, because we still want to know about the demand on things. Consider

    f (x,y) True  = error (show x)
    f (x,y) False = x+1

The signature of f should be &lt;S(SL),1*U(1*U(U),A)&gt;&lt;S,1*U&gt;m. If we were not
distinguishing the uses on x and y in the True case, we could either not figure
out how deeply we can unpack x, or that we do not have to pass y.


************************************************************************
*                                                                      *
                     Serialisation
*                                                                      *
************************************************************************
-}</span><span>
</span><span id="line-1966"></span><span>
</span><span id="line-1967"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680809862"><span class="annot"><a href="GHC.Utils.Binary.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrDmd"><span class="hs-identifier hs-type">StrDmd</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1968"></span><span>  </span><span id="local-6989586621680809847"><span class="annot"><span class="annottext">put_ :: BinHandle -&gt; StrDmd -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var hs-var hs-var hs-var">put_</span></a></span></span><span> </span><span id="local-6989586621680809845"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809845"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809845"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1969"></span><span>  </span><span class="annot"><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span id="local-6989586621680809843"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809843"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809843"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">1</span></span><span>
</span><span id="line-1970"></span><span>  </span><span class="annot"><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span id="local-6989586621680809842"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809842"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-type">SCall</span></a></span><span> </span><span id="local-6989586621680809841"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809841"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809842"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">2</span></span><span>
</span><span id="line-1971"></span><span>                            </span><span class="annot"><span class="annottext">BinHandle -&gt; StrDmd -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809842"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809841"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1972"></span><span>  </span><span class="annot"><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span id="local-6989586621680809840"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809840"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-type">SProd</span></a></span><span> </span><span id="local-6989586621680809839"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680809839"><span class="hs-identifier hs-var">sx</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809840"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">3</span></span><span>
</span><span id="line-1973"></span><span>                            </span><span class="annot"><span class="annottext">BinHandle -&gt; [ArgStr] -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809840"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680809839"><span class="hs-identifier hs-var">sx</span></a></span><span>
</span><span id="line-1974"></span><span>  </span><span id="local-6989586621680809821"><span class="annot"><span class="annottext">get :: BinHandle -&gt; IO StrDmd
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var hs-var hs-var hs-var">get</span></a></span></span><span> </span><span id="local-6989586621680809819"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809819"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1975"></span><span>         </span><span id="local-6989586621680809818"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680809818"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO Word8
</span><a href="GHC.Utils.Binary.html#getByte"><span class="hs-identifier hs-var">getByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809819"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-1976"></span><span>         </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680809818"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1977"></span><span>           </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; IO StrDmd
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HyperStr"><span class="hs-identifier hs-var">HyperStr</span></a></span><span>
</span><span id="line-1978"></span><span>           </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; IO StrDmd
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="GHC.Types.Demand.html#HeadStr"><span class="hs-identifier hs-var">HeadStr</span></a></span><span>
</span><span id="line-1979"></span><span>           </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">2</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680809816"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809816"><span class="hs-identifier hs-var">s</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO StrDmd
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809819"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-1980"></span><span>                   </span><span class="annot"><span class="annottext">StrDmd -&gt; IO StrDmd
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StrDmd -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SCall"><span class="hs-identifier hs-var">SCall</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809816"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1981"></span><span>           </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680809815"><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680809815"><span class="hs-identifier hs-var">sx</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO [ArgStr]
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809819"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-1982"></span><span>                   </span><span class="annot"><span class="annottext">StrDmd -&gt; IO StrDmd
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ArgStr] -&gt; StrDmd
</span><a href="GHC.Types.Demand.html#SProd"><span class="hs-identifier hs-var">SProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgStr]
</span><a href="#local-6989586621680809815"><span class="hs-identifier hs-var">sx</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1983"></span><span>
</span><span id="line-1984"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680809812"><span class="annot"><a href="GHC.Utils.Binary.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgStr"><span class="hs-identifier hs-type">ArgStr</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1985"></span><span>    </span><span id="local-6989586621680809806"><span class="annot"><span class="annottext">put_ :: BinHandle -&gt; ArgStr -&gt; IO ()
</span><a href="#local-6989586621680809806"><span class="hs-identifier hs-var hs-var hs-var hs-var">put_</span></a></span></span><span> </span><span id="local-6989586621680809805"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809805"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgStr
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1986"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809805"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1987"></span><span>    </span><span class="annot"><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span id="local-6989586621680809804"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809804"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-type">Str</span></a></span><span> </span><span id="local-6989586621680809803"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809803"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1988"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809804"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">1</span></span><span>
</span><span id="line-1989"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; StrDmd -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809804"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809803"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1990"></span><span>
</span><span id="line-1991"></span><span>    </span><span id="local-6989586621680809795"><span class="annot"><span class="annottext">get :: BinHandle -&gt; IO ArgStr
</span><a href="#local-6989586621680809795"><span class="hs-identifier hs-var hs-var hs-var hs-var">get</span></a></span></span><span>  </span><span id="local-6989586621680809794"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809794"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-1992"></span><span>            </span><span id="local-6989586621680809793"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680809793"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO Word8
</span><a href="GHC.Utils.Binary.html#getByte"><span class="hs-identifier hs-var">getByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809794"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-1993"></span><span>            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680809793"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1994"></span><span>              </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ArgStr -&gt; IO ArgStr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ArgStr
forall s. Str s
</span><a href="GHC.Types.Demand.html#Lazy"><span class="hs-identifier hs-var">Lazy</span></a></span><span>
</span><span id="line-1995"></span><span>              </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680809792"><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809792"><span class="hs-identifier hs-var">s</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO StrDmd
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809794"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-1996"></span><span>                      </span><span class="annot"><span class="annottext">ArgStr -&gt; IO ArgStr
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(ArgStr -&gt; IO ArgStr) -&gt; ArgStr -&gt; IO ArgStr
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd -&gt; ArgStr
forall s. s -&gt; Str s
</span><a href="GHC.Types.Demand.html#Str"><span class="hs-identifier hs-var">Str</span></a></span><span> </span><span class="annot"><span class="annottext">StrDmd
</span><a href="#local-6989586621680809792"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1997"></span><span>
</span><span id="line-1998"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680809789"><span class="annot"><a href="GHC.Utils.Binary.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Count"><span class="hs-identifier hs-type">Count</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1999"></span><span>    </span><span id="local-6989586621680809785"><span class="annot"><span class="annottext">put_ :: BinHandle -&gt; Count -&gt; IO ()
</span><a href="#local-6989586621680809785"><span class="hs-identifier hs-var hs-var hs-var hs-var">put_</span></a></span></span><span> </span><span id="local-6989586621680809784"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809784"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809784"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span>
</span><span id="line-2000"></span><span>    </span><span class="annot"><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span id="local-6989586621680809783"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809783"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809783"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">1</span></span><span>
</span><span id="line-2001"></span><span>
</span><span id="line-2002"></span><span>    </span><span id="local-6989586621680809777"><span class="annot"><span class="annottext">get :: BinHandle -&gt; IO Count
</span><a href="#local-6989586621680809777"><span class="hs-identifier hs-var hs-var hs-var hs-var">get</span></a></span></span><span>  </span><span id="local-6989586621680809776"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809776"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680809775"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680809775"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO Word8
</span><a href="GHC.Utils.Binary.html#getByte"><span class="hs-identifier hs-var">getByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809776"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2003"></span><span>                 </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680809775"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2004"></span><span>                   </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Count -&gt; IO Count
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#One"><span class="hs-identifier hs-var">One</span></a></span><span>
</span><span id="line-2005"></span><span>                   </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Count -&gt; IO Count
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="GHC.Types.Demand.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span>
</span><span id="line-2006"></span><span>
</span><span id="line-2007"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680809772"><span class="annot"><a href="GHC.Utils.Binary.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#ArgUse"><span class="hs-identifier hs-type">ArgUse</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-2008"></span><span>    </span><span id="local-6989586621680809764"><span class="annot"><span class="annottext">put_ :: BinHandle -&gt; ArgUse -&gt; IO ()
</span><a href="#local-6989586621680809764"><span class="hs-identifier hs-var hs-var hs-var hs-var">put_</span></a></span></span><span> </span><span id="local-6989586621680809763"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809763"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="annot"><span class="annottext">ArgUse
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-2009"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809763"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span>
</span><span id="line-2010"></span><span>    </span><span class="annot"><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span id="local-6989586621680809762"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809762"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-type">Use</span></a></span><span> </span><span id="local-6989586621680809761"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809761"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680809760"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809760"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-2011"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809762"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">1</span></span><span>
</span><span id="line-2012"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; Count -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809762"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809761"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-2013"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; UseDmd -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809762"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809760"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-2014"></span><span>
</span><span id="line-2015"></span><span>    </span><span id="local-6989586621680809750"><span class="annot"><span class="annottext">get :: BinHandle -&gt; IO ArgUse
</span><a href="#local-6989586621680809750"><span class="hs-identifier hs-var hs-var hs-var hs-var">get</span></a></span></span><span>  </span><span id="local-6989586621680809749"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809749"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-2016"></span><span>            </span><span id="local-6989586621680809748"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680809748"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO Word8
</span><a href="GHC.Utils.Binary.html#getByte"><span class="hs-identifier hs-var">getByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809749"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2017"></span><span>            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680809748"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2018"></span><span>              </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">ArgUse -&gt; IO ArgUse
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">ArgUse
forall u. Use u
</span><a href="GHC.Types.Demand.html#Abs"><span class="hs-identifier hs-var">Abs</span></a></span><span>
</span><span id="line-2019"></span><span>              </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680809747"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809747"><span class="hs-identifier hs-var">c</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO Count
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809749"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2020"></span><span>                      </span><span id="local-6989586621680809746"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809746"><span class="hs-identifier hs-var">u</span></a></span></span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO UseDmd
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809749"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2021"></span><span>                      </span><span class="annot"><span class="annottext">ArgUse -&gt; IO ArgUse
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(ArgUse -&gt; IO ArgUse) -&gt; ArgUse -&gt; IO ArgUse
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; ArgUse
forall u. Count -&gt; u -&gt; Use u
</span><a href="GHC.Types.Demand.html#Use"><span class="hs-identifier hs-var">Use</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809747"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809746"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-2022"></span><span>
</span><span id="line-2023"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680809743"><span class="annot"><a href="GHC.Utils.Binary.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#UseDmd"><span class="hs-identifier hs-type">UseDmd</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-2024"></span><span>    </span><span id="local-6989586621680809730"><span class="annot"><span class="annottext">put_ :: BinHandle -&gt; UseDmd -&gt; IO ()
</span><a href="#local-6989586621680809730"><span class="hs-identifier hs-var hs-var hs-var hs-var">put_</span></a></span></span><span> </span><span id="local-6989586621680809729"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809729"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-2025"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809729"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span>
</span><span id="line-2026"></span><span>    </span><span class="annot"><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span id="local-6989586621680809728"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809728"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-2027"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809728"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">1</span></span><span>
</span><span id="line-2028"></span><span>    </span><span class="annot"><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span id="local-6989586621680809727"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809727"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-type">UCall</span></a></span><span> </span><span id="local-6989586621680809726"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809726"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span id="local-6989586621680809725"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809725"><span class="hs-identifier hs-var">u</span></a></span></span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-2029"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809727"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">2</span></span><span>
</span><span id="line-2030"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; Count -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809727"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809726"><span class="hs-identifier hs-var">c</span></a></span><span>
</span><span id="line-2031"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; UseDmd -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809727"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809725"><span class="hs-identifier hs-var">u</span></a></span><span>
</span><span id="line-2032"></span><span>    </span><span class="annot"><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span id="local-6989586621680809724"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809724"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-type">UProd</span></a></span><span> </span><span id="local-6989586621680809723"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680809723"><span class="hs-identifier hs-var">ux</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-2033"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809724"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">3</span></span><span>
</span><span id="line-2034"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; [ArgUse] -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809724"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680809723"><span class="hs-identifier hs-var">ux</span></a></span><span>
</span><span id="line-2035"></span><span>
</span><span id="line-2036"></span><span>    </span><span id="local-6989586621680809704"><span class="annot"><span class="annottext">get :: BinHandle -&gt; IO UseDmd
</span><a href="#local-6989586621680809704"><span class="hs-identifier hs-var hs-var hs-var hs-var">get</span></a></span></span><span>  </span><span id="local-6989586621680809703"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809703"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-2037"></span><span>            </span><span id="local-6989586621680809702"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680809702"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO Word8
</span><a href="GHC.Utils.Binary.html#getByte"><span class="hs-identifier hs-var">getByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809703"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2038"></span><span>            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680809702"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2039"></span><span>              </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; IO UseDmd
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(UseDmd -&gt; IO UseDmd) -&gt; UseDmd -&gt; IO UseDmd
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#Used"><span class="hs-identifier hs-var">Used</span></a></span><span>
</span><span id="line-2040"></span><span>              </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">UseDmd -&gt; IO UseDmd
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(UseDmd -&gt; IO UseDmd) -&gt; UseDmd -&gt; IO UseDmd
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="GHC.Types.Demand.html#UHead"><span class="hs-identifier hs-var">UHead</span></a></span><span>
</span><span id="line-2041"></span><span>              </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">2</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680809701"><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809701"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO Count
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809703"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2042"></span><span>                      </span><span id="local-6989586621680809700"><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809700"><span class="hs-identifier hs-var">u</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO UseDmd
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809703"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2043"></span><span>                      </span><span class="annot"><span class="annottext">UseDmd -&gt; IO UseDmd
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Count -&gt; UseDmd -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UCall"><span class="hs-identifier hs-var">UCall</span></a></span><span> </span><span class="annot"><span class="annottext">Count
</span><a href="#local-6989586621680809701"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="annot"><span class="annottext">UseDmd
</span><a href="#local-6989586621680809700"><span class="hs-identifier hs-var">u</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2044"></span><span>              </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680809699"><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680809699"><span class="hs-identifier hs-var">ux</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO [ArgUse]
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809703"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2045"></span><span>                      </span><span class="annot"><span class="annottext">UseDmd -&gt; IO UseDmd
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ArgUse] -&gt; UseDmd
</span><a href="GHC.Types.Demand.html#UProd"><span class="hs-identifier hs-var">UProd</span></a></span><span> </span><span class="annot"><span class="annottext">[ArgUse]
</span><a href="#local-6989586621680809699"><span class="hs-identifier hs-var">ux</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2046"></span><span>
</span><span id="line-2047"></span><span id="local-6989586621680810896"><span id="local-6989586621680810897"><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680809696"><span class="hs-special">(</span><span class="annot"><a href="GHC.Utils.Binary.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810897"><span class="hs-identifier hs-type">s</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Binary.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810896"><span class="hs-identifier hs-type">u</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Binary.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JointDmd"><span class="hs-identifier hs-type">JointDmd</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810897"><span class="hs-identifier hs-type">s</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680810896"><span class="hs-identifier hs-type">u</span></a></span><span class="hs-special">)</span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-2048"></span><span>    </span><span id="local-6989586621680809691"><span class="annot"><span class="annottext">put_ :: BinHandle -&gt; JointDmd s u -&gt; IO ()
</span><a href="#local-6989586621680809691"><span class="hs-identifier hs-var hs-var hs-var hs-var">put_</span></a></span></span><span> </span><span id="local-6989586621680809690"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809690"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: forall s u. JointDmd s u -&gt; s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680809689"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621680809689"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: forall s u. JointDmd s u -&gt; u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680809688"><span class="annot"><span class="annottext">u
</span><a href="#local-6989586621680809688"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; s -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809690"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621680809689"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; u -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809690"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">u
</span><a href="#local-6989586621680809688"><span class="hs-identifier hs-var">y</span></a></span><span>
</span><span id="line-2049"></span><span>    </span><span id="local-6989586621680809682"><span class="annot"><span class="annottext">get :: BinHandle -&gt; IO (JointDmd s u)
</span><a href="#local-6989586621680809682"><span class="hs-identifier hs-var hs-var hs-var hs-var">get</span></a></span></span><span>  </span><span id="local-6989586621680809681"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809681"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-2050"></span><span>              </span><span id="local-6989586621680809680"><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621680809680"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO s
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809681"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2051"></span><span>              </span><span id="local-6989586621680809679"><span class="annot"><span class="annottext">u
</span><a href="#local-6989586621680809679"><span class="hs-identifier hs-var">y</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO u
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809681"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2052"></span><span>              </span><span class="annot"><span class="annottext">JointDmd s u -&gt; IO (JointDmd s u)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(JointDmd s u -&gt; IO (JointDmd s u))
-&gt; JointDmd s u -&gt; IO (JointDmd s u)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">JD :: forall s u. s -&gt; u -&gt; JointDmd s u
</span><a href="GHC.Types.Demand.html#JD"><span class="hs-identifier hs-type">JD</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sd :: s
</span><a href="GHC.Types.Demand.html#sd"><span class="hs-identifier hs-var">sd</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">s
</span><a href="#local-6989586621680809680"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ud :: u
</span><a href="GHC.Types.Demand.html#ud"><span class="hs-identifier hs-var">ud</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">u
</span><a href="#local-6989586621680809679"><span class="hs-identifier hs-var">y</span></a></span><span> </span><span class="hs-special">}</span></span></span><span>
</span><span id="line-2053"></span><span>
</span><span id="line-2054"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680809676"><span class="annot"><a href="GHC.Utils.Binary.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-2055"></span><span>    </span><span id="local-6989586621680809673"><span class="annot"><span class="annottext">put_ :: BinHandle -&gt; StrictSig -&gt; IO ()
</span><a href="#local-6989586621680809673"><span class="hs-identifier hs-var hs-var hs-var hs-var">put_</span></a></span></span><span> </span><span id="local-6989586621680809672"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809672"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-type">StrictSig</span></a></span><span> </span><span id="local-6989586621680809671"><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809671"><span class="hs-identifier hs-var">aa</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-2056"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; DmdType -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809672"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809671"><span class="hs-identifier hs-var">aa</span></a></span><span>
</span><span id="line-2057"></span><span>    </span><span id="local-6989586621680809667"><span class="annot"><span class="annottext">get :: BinHandle -&gt; IO StrictSig
</span><a href="#local-6989586621680809667"><span class="hs-identifier hs-var hs-var hs-var hs-var">get</span></a></span></span><span> </span><span id="local-6989586621680809666"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809666"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-2058"></span><span>          </span><span id="local-6989586621680809665"><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809665"><span class="hs-identifier hs-var">aa</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO DmdType
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809666"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2059"></span><span>          </span><span class="annot"><span class="annottext">StrictSig -&gt; IO StrictSig
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdType -&gt; StrictSig
</span><a href="GHC.Types.Demand.html#StrictSig"><span class="hs-identifier hs-var">StrictSig</span></a></span><span> </span><span class="annot"><span class="annottext">DmdType
</span><a href="#local-6989586621680809665"><span class="hs-identifier hs-var">aa</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2060"></span><span>
</span><span id="line-2061"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680809662"><span class="annot"><a href="GHC.Utils.Binary.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-2062"></span><span>  </span><span class="hs-comment">-- Ignore DmdEnv when spitting out the DmdType</span><span>
</span><span id="line-2063"></span><span>  </span><span id="local-6989586621680809654"><span class="annot"><span class="annottext">put_ :: BinHandle -&gt; DmdType -&gt; IO ()
</span><a href="#local-6989586621680809654"><span class="hs-identifier hs-var hs-var hs-var hs-var">put_</span></a></span></span><span> </span><span id="local-6989586621680809653"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809653"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-type">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680809652"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809652"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span id="local-6989586621680809651"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809651"><span class="hs-identifier hs-var">dr</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-2064"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; [Demand] -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809653"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809652"><span class="hs-identifier hs-var">ds</span></a></span><span>
</span><span id="line-2065"></span><span>            </span><span class="annot"><span class="annottext">BinHandle -&gt; Divergence -&gt; IO ()
forall a. Binary a =&gt; BinHandle -&gt; a -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809653"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809651"><span class="hs-identifier hs-var">dr</span></a></span><span>
</span><span id="line-2066"></span><span>  </span><span id="local-6989586621680809642"><span class="annot"><span class="annottext">get :: BinHandle -&gt; IO DmdType
</span><a href="#local-6989586621680809642"><span class="hs-identifier hs-var hs-var hs-var hs-var">get</span></a></span></span><span> </span><span id="local-6989586621680809641"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809641"><span class="hs-identifier hs-var">bh</span></a></span></span><span>
</span><span id="line-2067"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680809640"><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809640"><span class="hs-identifier hs-var">ds</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO [Demand]
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809641"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2068"></span><span>           </span><span id="local-6989586621680809639"><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809639"><span class="hs-identifier hs-var">dr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO Divergence
forall a. Binary a =&gt; BinHandle -&gt; IO a
</span><a href="GHC.Utils.Binary.html#get"><span class="hs-identifier hs-var">get</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809641"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2069"></span><span>           </span><span class="annot"><span class="annottext">DmdType -&gt; IO DmdType
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DmdEnv -&gt; [Demand] -&gt; Divergence -&gt; DmdType
</span><a href="GHC.Types.Demand.html#DmdType"><span class="hs-identifier hs-var">DmdType</span></a></span><span> </span><span class="annot"><span class="annottext">DmdEnv
</span><a href="GHC.Types.Demand.html#emptyDmdEnv"><span class="hs-identifier hs-var">emptyDmdEnv</span></a></span><span> </span><span class="annot"><span class="annottext">[Demand]
</span><a href="#local-6989586621680809640"><span class="hs-identifier hs-var">ds</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="#local-6989586621680809639"><span class="hs-identifier hs-var">dr</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-2070"></span><span>
</span><span id="line-2071"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621680809636"><span class="annot"><a href="GHC.Utils.Binary.html#Binary"><span class="hs-identifier hs-type">Binary</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Demand.html#Divergence"><span class="hs-identifier hs-type">Divergence</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-2072"></span><span>  </span><span id="local-6989586621680809631"><span class="annot"><span class="annottext">put_ :: BinHandle -&gt; Divergence -&gt; IO ()
</span><a href="#local-6989586621680809631"><span class="hs-identifier hs-var hs-var hs-var hs-var">put_</span></a></span></span><span> </span><span id="local-6989586621680809630"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809630"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809630"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span>
</span><span id="line-2073"></span><span>  </span><span class="annot"><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span id="local-6989586621680809629"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809629"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#ExnOrDiv"><span class="hs-identifier hs-var">ExnOrDiv</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809629"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">1</span></span><span>
</span><span id="line-2074"></span><span>  </span><span class="annot"><a href="GHC.Utils.Binary.html#put_"><span class="hs-identifier hs-var">put_</span></a></span><span> </span><span id="local-6989586621680809628"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809628"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; Word8 -&gt; IO ()
</span><a href="GHC.Utils.Binary.html#putByte"><span class="hs-identifier hs-var">putByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809628"><span class="hs-identifier hs-var">bh</span></a></span><span> </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">2</span></span><span>
</span><span id="line-2075"></span><span>
</span><span id="line-2076"></span><span>  </span><span id="local-6989586621680809619"><span class="annot"><span class="annottext">get :: BinHandle -&gt; IO Divergence
</span><a href="#local-6989586621680809619"><span class="hs-identifier hs-var hs-var hs-var hs-var">get</span></a></span></span><span> </span><span id="local-6989586621680809618"><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809618"><span class="hs-identifier hs-var">bh</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621680809617"><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680809617"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">BinHandle -&gt; IO Word8
</span><a href="GHC.Utils.Binary.html#getByte"><span class="hs-identifier hs-var">getByte</span></a></span><span> </span><span class="annot"><span class="annottext">BinHandle
</span><a href="#local-6989586621680809618"><span class="hs-identifier hs-var">bh</span></a></span><span>
</span><span id="line-2077"></span><span>              </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Word8
</span><a href="#local-6989586621680809617"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-2078"></span><span>                  </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">0</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; IO Divergence
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Dunno"><span class="hs-identifier hs-var">Dunno</span></a></span><span>
</span><span id="line-2079"></span><span>                  </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-number">1</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; IO Divergence
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#ExnOrDiv"><span class="hs-identifier hs-var">ExnOrDiv</span></a></span><span>
</span><span id="line-2080"></span><span>                  </span><span class="annot"><span class="annottext">Word8
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Divergence -&gt; IO Divergence
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Divergence
</span><a href="GHC.Types.Demand.html#Diverges"><span class="hs-identifier hs-var">Diverges</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-2081"></span></pre></body></html>